apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@algroup.co.uk>
Subject Re: apr_strcat optimization(s)
Date Wed, 20 Jun 2001 15:41:06 GMT
Doug MacEachern wrote:
> 
> 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';

Err, cp[len]='\0', perlease!

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

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

In SF until 21st April - http://ApacheCon.com/

Mime
View raw message