There are some convenience functions in zend_operators.h which would save having to repeat this logic (I think they are called zend_binary_strcmp() and zend_binary_zval_strcmp()).
Andi > -----Original Message----- > From: Antony Dovgal [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 16, 2007 3:35 PM > To: Jani Taskinen > Cc: php-cvs@lists.php.net > Subject: Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard > basic_functions.c /ext/standard/tests/network ip.phpt > > On 17.08.2007 02:17, Jani Taskinen wrote: > > - if (!memcmp(Z_STRVAL_PP(str), "255.255.255.255", > Z_STRLEN_PP(str))) { > > + if (!memcmp(Z_STRVAL_PP(str), "255.255.255.255", > sizeof("255.255.255.255") - 1)) { > > RETURN_LONG(-1); > > } > > Are you sure it is correct to compare first 15 bytes of _empty string_ > with "255.255.255.255"? > I'd say it should look like this: > > if (Z_STRLEN_PP(str) == (sizeof("255.255.255.255") - 1) && > !memcmp(Z_STRVAL_PP(str), "255.255.255.255", Z_STRLEN_PP(str))) { > > > -- > Wbr, > Antony Dovgal > > -- > PHP CVS Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php