]> granicus.if.org Git - apache/commitdiff
Reduce CPU consumption in conv_10 function, used to format "%d" by apr_*printf
authorGreg Ames <gregames@apache.org>
Tue, 24 Jul 2001 22:55:29 +0000 (22:55 +0000)
committerGreg Ames <gregames@apache.org>
Tue, 24 Jul 2001 22:55:29 +0000 (22:55 +0000)
This includes two changes to APR:
  * new functions apr_itoa, apr_ltoa, and apr_off_t_toa
    that provide itoa-type functionality based on pools
  * Inline code in inet_ntop4 to replace sprintf for converting
    binary IP addresses into dotted-decimal format

and two changes to Apache:
  * use the apr_itoa functions in setting the content length,
    in place of apr_psprintf
  * use the apr_itoa functions to replace frequent uses of
    'sprintf("%d",...)' in mod_log_config.

Submitted by: Brian Pane
Reviewed by:  Dean Gaudet, Greg Ames

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89686 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/loggers/mod_log_config.c
server/protocol.c

diff --git a/CHANGES b/CHANGES
index f4599190539bc78db0c82cc478b9c142f4f7d5d7..66dd303582cd3dbade760f85c7fd6b939181f277 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,9 @@
 Changes with Apache 2.0.22-dev
+
+  *) Use new APR number conversion functions to reduce CPU consumption 
+     when setting the content length, and in mod_log_config.
+     [Brian Pane]
+     
   *) Fix problem reported by Taketo Kabe <kabe@sra-tohoku.co.jp>
      where HEAD response headers were being repeated twice for
      files greater than 32K bytes (4*AP_MIN_BYTES_TO_WRITE). This
index 1b801cc79ffd3a9e9d9da5cbe7af482913450f49..c42fdb03c6ab210d1f273e65037e555f50f425bd 100644 (file)
@@ -284,7 +284,7 @@ typedef struct {
 
 static char *format_integer(apr_pool_t *p, int i)
 {
-    return apr_psprintf(p, "%d", i);
+    return apr_itoa(p, i);
 }
 
 static char *pfmt(apr_pool_t *p, int i)
@@ -381,7 +381,7 @@ static const char *clf_log_bytes_sent(request_rec *r, char *a)
         return "-";
     }
     else {
-       return apr_psprintf(r->pool, "%ld", r->bytes_sent);
+       return apr_ltoa(r->pool, r->bytes_sent);
     }
 }
 
index b8ec3cc6ab67df7b1f163ef044b66a18b1b14ac6..d62a1fa78f59299fc8c6455bb07593e8196181d6 100644 (file)
@@ -154,7 +154,7 @@ AP_DECLARE(void) ap_set_content_length(request_rec *r, apr_off_t clength)
 {
     r->clength = clength;
     apr_table_setn(r->headers_out, "Content-Length",
-                   apr_psprintf(r->pool, "%" APR_OFF_T_FMT, clength));
+                  apr_off_t_toa(r->pool, clength));
 }
 
 /*