Re: [PHP4BETA] cvs: /php4 SAPI.c SAPI.h /php4/sapi/apache mod_php4.c /php4/sapi/isapi php4isapi.c
| From: | Zeev Suraski | Date: | Sat, 26 Feb 2000 14:45: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-11039@lists.php.net to get a copy of this message | ||
On Sat, 26 Feb 2000, Stig Bakken wrote:
> Zeev Suraski wrote:
> >
> > zeev Fri Feb 25 21:04:11 2000 EDT
> >
> > Modified files:
> > /php4 SAPI.c SAPI.h
> > /php4/sapi/apache mod_php4.c
> > /php4/sapi/isapi php4isapi.c
> > Log:
> > - From CODING_STANDARDS:
> > [6] NEVER USE strncat(). If you're absolutely sure you know what you're
> > doing,
> > check its man page again, and only then, consider using it, and even then,
> > try avoiding it.
> > strncat() is your enemy!
>
> 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 :)
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;
Zeev
--
Zeev Suraski <zeev@zend.com>
http://www.zend.com/