You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Davi Arnaut <da...@haxent.com.br> on 2007/04/27 16:29:18 UTC

[patch 0/9] assorted patches

A few misc bug fixes and enchantments.

--
Davi Arnaut

[patch 8/9] exclusive semaphore create

Posted by Davi Arnaut <da...@haxent.com.br>.
The use of O_EXCL does help, better fail then use a semaphore not owned by
the caller. O_EXCL guarantees the open will fail if the semaphore named name
already exists. If it fails with EEXIST, a new semaphore name is tried.

---
 srclib/apr/locks/unix/proc_mutex.c |   23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

Index: 2.2.x/srclib/apr/locks/unix/proc_mutex.c
===================================================================
--- 2.2.x.orig/srclib/apr/locks/unix/proc_mutex.c	2007-04-27 11:09:48.000000000 -0300
+++ 2.2.x/srclib/apr/locks/unix/proc_mutex.c	2007-04-27 11:09:52.000000000 -0300
@@ -79,23 +79,22 @@
      * implementation. Versions previous to Darwin 6.2 had the 14
      * char limit, but later rev's allow up to 31 characters.
      *
-     * FIXME: There is a small window of opportunity where
-     * instead of getting a new semaphore descriptor, we get
-     * a previously obtained one. This can happen if the requests
-     * are made at the "same time" and in the small span of time between
-     * the sem_open and the sem_unlink. Use of O_EXCL does not
-     * help here however...
-     *
      */
     now = apr_time_now();
     sec = apr_time_sec(now);
     usec = apr_time_usec(now);
     apr_snprintf(semname, sizeof(semname), "/ApR.%lxZ%lx", sec, usec);
-    psem = sem_open(semname, O_CREAT, 0644, 1);
-    if ((psem == (sem_t *)SEM_FAILED) && (errno == ENAMETOOLONG)) {
-        /* Oh well, good try */
-        semname[13] = '\0';
-        psem = sem_open(semname, O_CREAT, 0644, 1);
+    psem = sem_open(semname, O_CREAT | O_EXCL, 0644, 1);
+    if ((psem == (sem_t *)SEM_FAILED)) {
+        if (errno == ENAMETOOLONG) {
+            /* Oh well, good try */
+            semname[13] = '\0';
+        } else if (errno == EEXIST) {
+            apr_snprintf(semname, sizeof(semname), "/ApR.%lxZ%lx", usec, sec);
+        } else {
+            return errno;
+        }
+        psem = sem_open(semname, O_CREAT | O_EXCL, 0644, 1);
     }
 
     if (psem == (sem_t *)SEM_FAILED) {

--

[patch 3/9] change unknown macro

Posted by Davi Arnaut <da...@haxent.com.br>.
APR_VOID_P_IS_QUAD is not defined anywhere and the usual way is
using APR_SIZEOF_VOIDP. PR 40758.

---
 srclib/apr/strings/apr_snprintf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: 2.2.x/srclib/apr/strings/apr_snprintf.c
===================================================================
--- 2.2.x.orig/srclib/apr/strings/apr_snprintf.c	2007-04-27 11:09:50.000000000 -0300
+++ 2.2.x/srclib/apr/strings/apr_snprintf.c	2007-04-27 11:09:50.000000000 -0300
@@ -1104,7 +1104,7 @@
                  * don't handle "%p".
                  */
                 case 'p':
-#ifdef APR_VOID_P_IS_QUAD
+#if APR_SIZEOF_VOIDP == 8
                     if (sizeof(void *) <= sizeof(u_widest_int)) {
                         ui_quad = (u_widest_int) va_arg(ap, void *);
                         s = conv_p2_quad(ui_quad, 4, 'x',

--

[patch 1/9] Early assignment yields better code

Posted by Davi Arnaut <da...@haxent.com.br>.
Early assignment of the to-be-converted number yields better code and avoids
ugly casts.

---
 srclib/apr/strings/apr_snprintf.c |   14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

Index: 2.2.x/srclib/apr/strings/apr_snprintf.c
===================================================================
--- 2.2.x.orig/srclib/apr/strings/apr_snprintf.c	2007-04-27 11:09:49.000000000 -0300
+++ 2.2.x/srclib/apr/strings/apr_snprintf.c	2007-04-27 11:09:49.000000000 -0300
@@ -343,10 +343,9 @@
                      register apr_size_t *len)
 {
     register char *p = buf_end;
-    register u_wide_int magnitude;
+    register u_wide_int magnitude = num;
 
     if (is_unsigned) {
-        magnitude = (u_wide_int) num;
         *is_negative = FALSE;
     }
     else {
@@ -363,11 +362,8 @@
          */
         if (*is_negative) {
             wide_int t = num + 1;
-
             magnitude = ((u_wide_int) -t) + 1;
         }
-        else
-            magnitude = (u_wide_int) num;
     }
 
     /*
@@ -390,20 +386,19 @@
                      register apr_size_t *len)
 {
     register char *p = buf_end;
-    u_widest_int magnitude;
+    u_widest_int magnitude = num;
 
     /*
      * We see if we can use the faster non-quad version by checking the
      * number against the largest long value it can be. If <=, we
      * punt to the quicker version.
      */
-    if (((u_widest_int)num <= (u_widest_int)ULONG_MAX && is_unsigned) 
+    if ((magnitude <= ULONG_MAX && is_unsigned)
         || (num <= LONG_MAX && num >= LONG_MIN && !is_unsigned))
             return(conv_10( (wide_int)num, is_unsigned, is_negative,
                buf_end, len));
 
     if (is_unsigned) {
-        magnitude = (u_widest_int) num;
         *is_negative = FALSE;
     }
     else {
@@ -420,11 +415,8 @@
          */
         if (*is_negative) {
             widest_int t = num + 1;
-
             magnitude = ((u_widest_int) -t) + 1;
         }
-        else
-            magnitude = (u_widest_int) num;
     }
 
     /*

--

[patch 5/9] apr_strfsize format

Posted by Davi Arnaut <da...@haxent.com.br>.
Binary size formatter as bytes, K, M, T, etc, for apr_vformatter based
upon apr_strfsize.

---
 srclib/apr/include/apr_lib.h      |    3 +++
 srclib/apr/strings/apr_snprintf.c |   26 ++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

Index: 2.2.x/srclib/apr/include/apr_lib.h
===================================================================
--- 2.2.x.orig/srclib/apr/include/apr_lib.h	2007-04-27 11:09:49.000000000 -0300
+++ 2.2.x/srclib/apr/include/apr_lib.h	2007-04-27 11:09:51.000000000 -0300
@@ -121,6 +121,9 @@
  * %%pm takes an apr_status_t * and prints the appropriate error
  *      string (from apr_strerror) corresponding to that error code.
  * %%pp takes a void * and outputs it in hex
+ * %%pB takes a apr_uint32_t * as bytes and outputs it's apr_strfsize
+ * %%pF same as above, but takes a apr_off_t *
+ * %%pS same as above, but takes a apr_size_t *
  *
  * %%pt is only available from APR 1.2.0 onwards.
  * %%pm is only available from APR 1.3.0 onwards.
Index: 2.2.x/srclib/apr/strings/apr_snprintf.c
===================================================================
--- 2.2.x.orig/srclib/apr/strings/apr_snprintf.c	2007-04-27 11:09:50.000000000 -0300
+++ 2.2.x/srclib/apr/strings/apr_snprintf.c	2007-04-27 11:09:51.000000000 -0300
@@ -1220,6 +1220,32 @@
 #endif
                     break;
 
+                case 'B':
+                case 'F':
+                case 'S':
+                {
+                    char buf[5];
+                    apr_off_t size = 0;
+
+                    if (*fmt == 'B') {
+                        apr_uint32_t *arg = va_arg(ap, apr_uint32_t *);
+                        size = (arg) ? *arg : 0;
+                    }
+                    else if (*fmt == 'F') {
+                        apr_off_t *arg = va_arg(ap, apr_off_t *);
+                        size = (arg) ? *arg : 0;
+                    }
+                    else {
+                        apr_size_t *arg = va_arg(ap, apr_size_t *);
+                        size = (arg) ? *arg : 0;
+                    }
+
+                    s = apr_strfsize(size, buf);
+                    s_len = strlen(s);
+                    pad_char = ' ';
+                }
+                break;
+
                 case NUL:
                     /* if %p ends the string, oh well ignore it */
                     continue;

--

[patch 7/9] share apr_file_t buffers

Posted by Davi Arnaut <da...@haxent.com.br>.
Share buffers for files opened from the same pool. This may a few KBs for
code paths like:

apr_file_open(f, p);
read/write
apr_file_close(f);

apr_file_open(f, p);
read/write
apr_file_close(f);

---
 srclib/apr/file_io/unix/open.c |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Index: 2.2.x/srclib/apr/file_io/unix/open.c
===================================================================
--- 2.2.x.orig/srclib/apr/file_io/unix/open.c	2007-04-27 11:09:48.000000000 -0300
+++ 2.2.x/srclib/apr/file_io/unix/open.c	2007-04-27 11:09:51.000000000 -0300
@@ -26,6 +26,8 @@
 #include "fsio.h"
 #endif
 
+static const char file_cache_buffer_key[] = "FILE_CACHE_BUFFER";
+
 apr_status_t apr_unix_file_cleanup(void *thefile)
 {
     apr_file_t *file = thefile;
@@ -34,6 +36,8 @@
     if (file->buffered) {
         /* XXX: flush here is not mutex protected */
         flush_rv = apr_file_flush(file);
+        apr_pool_userdata_setn(file->buffer, file_cache_buffer_key,
+                               apr_pool_cleanup_null, file->pool);
     }
     if (close(file->filedes) == 0) {
         file->filedes = -1;
@@ -151,7 +155,18 @@
     (*new)->buffered = (flag & APR_BUFFERED) > 0;
 
     if ((*new)->buffered) {
-        (*new)->buffer = apr_palloc(pool, APR_FILE_DEFAULT_BUFSIZE);
+        void *buffer = NULL;
+
+        apr_pool_userdata_get(&buffer, file_cache_buffer_key, pool);
+
+        if (!buffer) {
+            buffer = apr_palloc(pool, APR_FILE_DEFAULT_BUFSIZE);
+        }
+        else {
+            apr_pool_userdata_setn(NULL, file_cache_buffer_key,
+                                   apr_pool_cleanup_null, pool);
+        }
+        (*new)->buffer = buffer;
         (*new)->bufsize = APR_FILE_DEFAULT_BUFSIZE;
 #if APR_HAS_THREADS
         if ((*new)->flags & APR_XTHREAD) {

--

[patch 6/9] writev_full fallback

Posted by Davi Arnaut <da...@haxent.com.br>.
Rework apr_file_writev_full so it tries to writev() data before resorting to
a plain write.

---
 srclib/apr/file_io/unix/fullrw.c |   32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)

Index: 2.2.x/srclib/apr/file_io/unix/fullrw.c
===================================================================
--- 2.2.x.orig/srclib/apr/file_io/unix/fullrw.c	2007-04-27 11:09:48.000000000 -0300
+++ 2.2.x/srclib/apr/file_io/unix/fullrw.c	2007-04-27 11:09:51.000000000 -0300
@@ -72,10 +72,36 @@
     apr_size_t amt = 0;
     apr_size_t total = 0;
 
-    for (i = 0; i < nvec && rv == APR_SUCCESS; i++) {
-        rv = apr_file_write_full(thefile, vec[i].iov_base, 
+    for (i = 0; i < nvec; i++) {
+        total += vec[i].iov_len;
+    }
+
+    rv = apr_file_writev(thefile, vec, nvec, &amt);
+
+    if (bytes_written != NULL)
+        *bytes_written = amt;
+
+    if (rv != APR_SUCCESS || (amt == total)) {
+        return rv;
+    }
+
+    for (i = 0; i < nvec && amt; i++) {
+        if (amt >= vec[i].iov_len) {
+            amt -= vec[i].iov_len;
+        }
+        else {
+            break;
+        }
+    }
+
+    if (amt) {
+        rv = apr_file_write_full(thefile, vec[i].iov_base + amt,
+                                 vec[i].iov_len - amt, NULL);
+    }
+
+    for (; i < nvec && rv == APR_SUCCESS; i++) {
+        rv = apr_file_write_full(thefile, vec[i].iov_base,
                                  vec[i].iov_len, &amt);
-        total += amt;
     }
 
     if (bytes_written != NULL)

--

[patch 2/9] simpler integer to string conversion

Posted by Davi Arnaut <da...@haxent.com.br>.
Simpler and somewhat faster integer to string conversion. Emphasis on
the "simpler". Passes testfmt.

---
 srclib/apr/strings/apr_snprintf.c |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

Index: 2.2.x/srclib/apr/strings/apr_snprintf.c
===================================================================
--- 2.2.x.orig/srclib/apr/strings/apr_snprintf.c	2007-04-27 11:09:49.000000000 -0300
+++ 2.2.x/srclib/apr/strings/apr_snprintf.c	2007-04-27 11:09:50.000000000 -0300
@@ -370,12 +370,8 @@
      * We use a do-while loop so that we write at least 1 digit 
      */
     do {
-        register u_wide_int new_magnitude = magnitude / 10;
-
-        *--p = (char) (magnitude - new_magnitude * 10 + '0');
-        magnitude = new_magnitude;
-    }
-    while (magnitude);
+        *--p = (char) '0' + (magnitude % 10);
+    } while ((magnitude /= 10));
 
     *len = buf_end - p;
     return (p);
@@ -423,12 +419,8 @@
      * We use a do-while loop so that we write at least 1 digit 
      */
     do {
-        u_widest_int new_magnitude = magnitude / 10;
-
-        *--p = (char) (magnitude - new_magnitude * 10 + '0');
-        magnitude = new_magnitude;
-    }
-    while (magnitude);
+        *--p = (char) '0' + (magnitude % 10);
+    } while ((magnitude /= 10));
 
     *len = buf_end - p;
     return (p);

--

[patch 4/9] replace wide types

Posted by Davi Arnaut <da...@haxent.com.br>.
Convert wide* types to the portable apr types. Passes testfmt.

---
 srclib/apr/strings/apr_snprintf.c |   93 ++++++++++++++++----------------------
 1 file changed, 41 insertions(+), 52 deletions(-)

Index: 2.2.x/srclib/apr/strings/apr_snprintf.c
===================================================================
--- 2.2.x.orig/srclib/apr/strings/apr_snprintf.c	2007-04-27 11:09:50.000000000 -0300
+++ 2.2.x/srclib/apr/strings/apr_snprintf.c	2007-04-27 11:09:50.000000000 -0300
@@ -53,17 +53,7 @@
 #define TRUE 1
 #endif
 #define NUL '\0'
-#define WIDE_INT long
 
-typedef WIDE_INT wide_int;
-typedef unsigned WIDE_INT u_wide_int;
-typedef apr_int64_t widest_int;
-#ifdef __TANDEM
-/* Although Tandem supports "long long" there is no unsigned variant. */
-typedef unsigned long       u_widest_int;
-#else
-typedef apr_uint64_t u_widest_int;
-#endif
 typedef int bool_int;
 
 #define S_NULL "(null)"
@@ -338,12 +328,12 @@
  * (conv_10_quad), the other when we don't (conv_10). We're assuming the
  * latter is faster.
  */
-static char *conv_10(register wide_int num, register bool_int is_unsigned,
+static char *conv_10(register apr_int32_t num, register bool_int is_unsigned,
                      register bool_int *is_negative, char *buf_end,
                      register apr_size_t *len)
 {
     register char *p = buf_end;
-    register u_wide_int magnitude = num;
+    register apr_uint32_t magnitude = num;
 
     if (is_unsigned) {
         *is_negative = FALSE;
@@ -361,8 +351,8 @@
          *      d. add 1
          */
         if (*is_negative) {
-            wide_int t = num + 1;
-            magnitude = ((u_wide_int) -t) + 1;
+            apr_int32_t t = num + 1;
+            magnitude = ((apr_uint32_t) -t) + 1;
         }
     }
 
@@ -377,22 +367,21 @@
     return (p);
 }
 
-static char *conv_10_quad(widest_int num, register bool_int is_unsigned,
+static char *conv_10_quad(apr_int64_t num, register bool_int is_unsigned,
                      register bool_int *is_negative, char *buf_end,
                      register apr_size_t *len)
 {
     register char *p = buf_end;
-    u_widest_int magnitude = num;
+    apr_uint64_t magnitude = num;
 
     /*
      * We see if we can use the faster non-quad version by checking the
      * number against the largest long value it can be. If <=, we
      * punt to the quicker version.
      */
-    if ((magnitude <= ULONG_MAX && is_unsigned)
-        || (num <= LONG_MAX && num >= LONG_MIN && !is_unsigned))
-            return(conv_10( (wide_int)num, is_unsigned, is_negative,
-               buf_end, len));
+    if ((magnitude <= UINT32_MAX && is_unsigned)
+        || (num <= INT32_MAX && num >= INT32_MIN && !is_unsigned))
+            return(conv_10(num, is_unsigned, is_negative, buf_end, len));
 
     if (is_unsigned) {
         *is_negative = FALSE;
@@ -410,8 +399,8 @@
          *      d. add 1
          */
         if (*is_negative) {
-            widest_int t = num + 1;
-            magnitude = ((u_widest_int) -t) + 1;
+            apr_int64_t t = num + 1;
+            magnitude = ((apr_uint64_t) -t) + 1;
         }
     }
 
@@ -582,7 +571,7 @@
         *s++ = format;                /* either e or E */
         decimal_point--;
         if (decimal_point != 0) {
-            p = conv_10((wide_int) decimal_point, FALSE, &exponent_is_negative,
+            p = conv_10((apr_int32_t) decimal_point, FALSE, &exponent_is_negative,
                         &temp[EXPONENT_LENGTH], &t_len);
             *s++ = exponent_is_negative ? '-' : '+';
 
@@ -619,7 +608,7 @@
  * As with conv_10, we have a faster version which is used when
  * the number isn't quad size.
  */
-static char *conv_p2(register u_wide_int num, register int nbits,
+static char *conv_p2(register apr_uint32_t num, register int nbits,
                      char format, char *buf_end, register apr_size_t *len)
 {
     register int mask = (1 << nbits) - 1;
@@ -638,7 +627,7 @@
     return (p);
 }
 
-static char *conv_p2_quad(u_widest_int num, register int nbits,
+static char *conv_p2_quad(apr_uint64_t num, register int nbits,
                      char format, char *buf_end, register apr_size_t *len)
 {
     register int mask = (1 << nbits) - 1;
@@ -647,8 +636,8 @@
     static const char upper_digits[] = "0123456789ABCDEF";
     register const char *digits = (format == 'X') ? upper_digits : low_digits;
 
-    if (num <= ULONG_MAX)
-        return(conv_p2((u_wide_int)num, nbits, format, buf_end, len));
+    if (num <= UINT32_MAX)
+        return(conv_p2((apr_uint32_t)num, nbits, format, buf_end, len));
 
     do {
         *--p = digits[num & mask];
@@ -707,10 +696,10 @@
     char prefix_char;
 
     double fp_num;
-    widest_int i_quad = (widest_int) 0;
-    u_widest_int ui_quad;
-    wide_int i_num = (wide_int) 0;
-    u_wide_int ui_num;
+    apr_int64_t i_quad = 0;
+    apr_uint64_t ui_quad;
+    apr_int32_t i_num = 0;
+    apr_uint32_t ui_num;
 
     char num_buf[NUM_BUF_SIZE];
     char char_buf[2];                /* for printing %% and %<unknown> */
@@ -861,17 +850,17 @@
             switch (*fmt) {
             case 'u':
                 if (var_type == IS_QUAD) {
-                    i_quad = va_arg(ap, u_widest_int);
+                    i_quad = va_arg(ap, apr_uint64_t);
                     s = conv_10_quad(i_quad, 1, &is_negative,
                             &num_buf[NUM_BUF_SIZE], &s_len);
                 }
                 else {
                     if (var_type == IS_LONG)
-                        i_num = (wide_int) va_arg(ap, u_wide_int);
+                        i_num = (apr_int32_t) va_arg(ap, apr_uint32_t);
                     else if (var_type == IS_SHORT)
-                        i_num = (wide_int) (unsigned short) va_arg(ap, unsigned int);
+                        i_num = (apr_int32_t) (unsigned short) va_arg(ap, unsigned int);
                     else
-                        i_num = (wide_int) va_arg(ap, unsigned int);
+                        i_num = (apr_int32_t) va_arg(ap, unsigned int);
                     s = conv_10(i_num, 1, &is_negative,
                             &num_buf[NUM_BUF_SIZE], &s_len);
                 }
@@ -881,17 +870,17 @@
             case 'd':
             case 'i':
                 if (var_type == IS_QUAD) {
-                    i_quad = va_arg(ap, widest_int);
+                    i_quad = va_arg(ap, apr_int64_t);
                     s = conv_10_quad(i_quad, 0, &is_negative,
                             &num_buf[NUM_BUF_SIZE], &s_len);
                 }
                 else {
                     if (var_type == IS_LONG)
-                        i_num = (wide_int) va_arg(ap, wide_int);
+                        i_num = va_arg(ap, apr_int32_t);
                     else if (var_type == IS_SHORT)
-                        i_num = (wide_int) (short) va_arg(ap, int);
+                        i_num = (short) va_arg(ap, int);
                     else
-                        i_num = (wide_int) va_arg(ap, int);
+                        i_num = va_arg(ap, int);
                     s = conv_10(i_num, 0, &is_negative,
                             &num_buf[NUM_BUF_SIZE], &s_len);
                 }
@@ -908,17 +897,17 @@
 
             case 'o':
                 if (var_type == IS_QUAD) {
-                    ui_quad = va_arg(ap, u_widest_int);
+                    ui_quad = va_arg(ap, apr_uint64_t);
                     s = conv_p2_quad(ui_quad, 3, *fmt,
                             &num_buf[NUM_BUF_SIZE], &s_len);
                 }
                 else {
                     if (var_type == IS_LONG)
-                        ui_num = (u_wide_int) va_arg(ap, u_wide_int);
+                        ui_num = va_arg(ap, apr_uint32_t);
                     else if (var_type == IS_SHORT)
-                        ui_num = (u_wide_int) (unsigned short) va_arg(ap, unsigned int);
+                        ui_num = (unsigned short) va_arg(ap, unsigned int);
                     else
-                        ui_num = (u_wide_int) va_arg(ap, unsigned int);
+                        ui_num = va_arg(ap, unsigned int);
                     s = conv_p2(ui_num, 3, *fmt,
                             &num_buf[NUM_BUF_SIZE], &s_len);
                 }
@@ -933,17 +922,17 @@
             case 'x':
             case 'X':
                 if (var_type == IS_QUAD) {
-                    ui_quad = va_arg(ap, u_widest_int);
+                    ui_quad = va_arg(ap, apr_uint64_t);
                     s = conv_p2_quad(ui_quad, 4, *fmt,
                             &num_buf[NUM_BUF_SIZE], &s_len);
                 }
                 else {
                     if (var_type == IS_LONG)
-                        ui_num = (u_wide_int) va_arg(ap, u_wide_int);
+                        ui_num = va_arg(ap, apr_uint32_t);
                     else if (var_type == IS_SHORT)
-                        ui_num = (u_wide_int) (unsigned short) va_arg(ap, unsigned int);
+                        ui_num = (unsigned short) va_arg(ap, unsigned int);
                     else
-                        ui_num = (u_wide_int) va_arg(ap, unsigned int);
+                        ui_num = va_arg(ap, unsigned int);
                     s = conv_p2(ui_num, 4, *fmt,
                             &num_buf[NUM_BUF_SIZE], &s_len);
                 }
@@ -1081,7 +1070,7 @@
 
             case 'n':
                 if (var_type == IS_QUAD)
-                    *(va_arg(ap, widest_int *)) = cc;
+                    *(va_arg(ap, apr_int64_t *)) = cc;
                 else if (var_type == IS_LONG)
                     *(va_arg(ap, long *)) = cc;
                 else if (var_type == IS_SHORT)
@@ -1105,14 +1094,14 @@
                  */
                 case 'p':
 #if APR_SIZEOF_VOIDP == 8
-                    if (sizeof(void *) <= sizeof(u_widest_int)) {
-                        ui_quad = (u_widest_int) va_arg(ap, void *);
+                    if (sizeof(void *) <= sizeof(apr_uint64_t)) {
+                        ui_quad = (apr_uint64_t) va_arg(ap, void *);
                         s = conv_p2_quad(ui_quad, 4, 'x',
                                 &num_buf[NUM_BUF_SIZE], &s_len);
                     }
 #else
-                    if (sizeof(void *) <= sizeof(u_wide_int)) {
-                        ui_num = (u_wide_int) va_arg(ap, void *);
+                    if (sizeof(void *) <= sizeof(apr_uint32_t)) {
+                        ui_num = (apr_uint32_t) va_arg(ap, void *);
                         s = conv_p2(ui_num, 4, 'x',
                                 &num_buf[NUM_BUF_SIZE], &s_len);
                     }

--

[patch 9/9] os_version sed expression

Posted by Davi Arnaut <da...@haxent.com.br>.
The current os_version sed expression does not handle kernel version strings
after 2.6.9.

davi@karmic:~/$ uname -r
2.6.20-15-generic
davi@karmic:~/$ echo os_version=`uname -r | sed -e 's/\(.\)\.\(.\)\.\(.\).*/\1\2\3/'`
os_version=262
davi@karmic:~/$ echo os_version=`uname -r | sed -e 's/-.*//g' | sed -e 's/\.//g'`
os_version=2620

---
 srclib/apr/configure.in |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: 2.2.x/srclib/apr/configure.in
===================================================================
--- 2.2.x.orig/srclib/apr/configure.in	2007-04-27 11:09:48.000000000 -0300
+++ 2.2.x/srclib/apr/configure.in	2007-04-27 11:09:52.000000000 -0300
@@ -514,7 +514,7 @@
         fi
         ;;
     *linux*)
-        os_version=`uname -r | sed -e 's/\(.\)\.\(.\)\.\(.\).*/\1\2\3/'`
+        os_version=`uname -r | sed -e 's/-.*//g' | sed -e 's/\.//g'`
         ;;
     *)
         os_version=OS_VERSION_IS_NOT_SET

--