Re: CVS update: php3/functions

From: Date: Mon, 28 Dec 1998 20:11:09 +0000
Subject: Re: CVS update: php3/functions
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-3146@lists.php.net to get a copy of this message
On Mon, 28 Dec 1998, Zeev Suraski wrote: > Unless I'm missing something, I'm against this patch. The optimizations > seem to be trivial enough for any optimizing compiler to do them by itself; > The real problem is that it seems to change the behavior of the function > altogether (an empty element is returned for a NULL field, instead of that > element being unset). Yes, you are missing something :-) The old code was element = PQgetvalue(pgsql_result,row->value.lval,i); element_len = (element ? strlen(element) : 0); element = safe_estrndup(element,element_len); safe_estrndup is defined as #define safe_estrndup(ptr,len) \ ((ptr)?(estrndup((ptr),(len))):(empty_string)) So if PQgetvalue() returns NULL, safe_estrndup() will return empty_string which results in if(element) { /* always being executed */ } else { /* something commented out */ } Regards, Sascha Schumann | Consultant | finger sas@schell.de | for PGP public key -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#3146) next »