Re: [PHP4BETA] cvs: /php4 SAPI.c SAPI.h /php4/sapi/apache mod_php4.c/php4/sapi/isapi php4isapi.c

From: Date: Sat, 26 Feb 2000 15:42:46 +0000
Subject: Re: [PHP4BETA] cvs: /php4 SAPI.c SAPI.h /php4/sapi/apache mod_php4.c/php4/sapi/isapi php4isapi.c
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-11044@lists.php.net to get a copy of this message
Zeev Suraski wrote: > > On Sat, 26 Feb 2000, Stig Bakken wrote: > > > > > strncat() != strlcat() > > Ok :) I don't know what strlcat() is, but I guess it's what one would > generally expect strncat() to be, so I take it back - sorry :) Check out strlcat.c and strlcpy.c in the php4 dir. > Anyway, I'd generally extend it to 'most str*() functions are bad', > because they're slow, and if you already have more information about the > data you're dealing with (lengths), you're better off working with > memcpy() and exact offsets. > > strcpy(foo, bar); > strcat(foo, baz); > > is much slower than > > memcpy(foo, bar, bar_len); > memcpy(foo+bar_len, baz, baz_len); > foo[bar_len+baz_len] = 0; I agree in general, but we're talking about strings that are 4-20 bytes long here. sprintf() probably has more overhead anyway. - Stig

« previous php.version4 (#11044) next »