apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug MacEachern <do...@covalent.net>
Subject Re: apr_strcat optimization(s)
Date Wed, 20 Jun 2001 16:58:32 GMT
On Wed, 20 Jun 2001, Ben Laurie wrote:
 
> Err, cp[len]='\0', perlease!

ok.
 
> Its probably worth a fraction of a microsecond (or more) to put this at
> the end, btw.

at the end, like this?  interested, how is it faster?

--- srclib/apr/strings/apr_strings.c    2001/06/19 20:40:22     1.14
+++ srclib/apr/strings/apr_strings.c    2001/06/20 16:56:34
@@ -130,7 +130,6 @@
 
     res = (char *) apr_palloc(a, len + 1);
     cp = res;
-    *(cp + len) = '\0';
 
     /* Pass two --- copy the argument strings into the result space */
 
@@ -145,6 +144,8 @@
     va_end(adummy);
 
     /* Return the result string */
+
+    res[len] = '\0';
 
     return res;
 }



Mime
View raw message