apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r551923 - in /apr/apr/trunk: include/apr_lib.h strings/apr_snprintf.c
Date Fri, 29 Jun 2007 15:17:10 GMT
Author: davi
Date: Fri Jun 29 08:17:09 2007
New Revision: 551923

URL: http://svn.apache.org/viewvc?view=rev&rev=551923
Log:
Binary size apr_vformatter as bytes, K, M, T, etc, to a four character compacted
human readable form. Based upon apr_strfsize.

Modified:
    apr/apr/trunk/include/apr_lib.h
    apr/apr/trunk/strings/apr_snprintf.c

Modified: apr/apr/trunk/include/apr_lib.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_lib.h?view=diff&rev=551923&r1=551922&r2=551923
==============================================================================
--- apr/apr/trunk/include/apr_lib.h (original)
+++ apr/apr/trunk/include/apr_lib.h Fri Jun 29 08:17:09 2007
@@ -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.

Modified: apr/apr/trunk/strings/apr_snprintf.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/strings/apr_snprintf.c?view=diff&rev=551923&r1=551922&r2=551923
==============================================================================
--- apr/apr/trunk/strings/apr_snprintf.c (original)
+++ apr/apr/trunk/strings/apr_snprintf.c Fri Jun 29 08:17:09 2007
@@ -1239,6 +1239,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;



Mime
View raw message