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 Tue, 19 Jun 2001 18:25:28 GMT
On 19 Jun 2001, Jeff Trawick wrote:
 
> cp doesn't point to the end of the string to be built yet.  If you had
> 
>   *(cp + len) = '\0';
> 
> then I'd believe you.

oh right, here is the current patch..

--- srclib/apr/strings/apr_strings.c    2001/05/10 18:05:18     1.13
+++ srclib/apr/strings/apr_strings.c    2001/06/19 18:22:53
@@ -130,15 +130,16 @@
 
     res = (char *) apr_palloc(a, len + 1);
     cp = res;
-    *cp = '\0';
+    *(cp + len) = '\0';
 
     /* Pass two --- copy the argument strings into the result space */
 
     va_start(adummy, a);
 
     while ((argp = va_arg(adummy, char *)) != NULL) {
-        strcpy(cp, argp);
-        cp += strlen(argp);
+        len = strlen(argp);
+        memcpy(cp, argp, len);
+        cp += len;
     }
 
     va_end(adummy);




Mime
View raw message