Date: 12/28/98
- Next message: Zeev Suraski: "Re: [PHP-DEV] CVS update: php3/functions"
- Previous message: eschmid: "[PHP-DEV] CVS update: php3/functions"
- In reply to: Zeev Suraski: "Re: [PHP-DEV] CVS update: php3/functions"
- Next in thread: Zeev Suraski: "Re: [PHP-DEV] CVS update: php3/functions"
- Reply: Zeev Suraski: "Re: [PHP-DEV] CVS update: php3/functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 <email protected>
| for PGP public key
-- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe <email protected> For help: php-dev-help <email protected>
- Next message: Zeev Suraski: "Re: [PHP-DEV] CVS update: php3/functions"
- Previous message: eschmid: "[PHP-DEV] CVS update: php3/functions"
- In reply to: Zeev Suraski: "Re: [PHP-DEV] CVS update: php3/functions"
- Next in thread: Zeev Suraski: "Re: [PHP-DEV] CVS update: php3/functions"
- Reply: Zeev Suraski: "Re: [PHP-DEV] CVS update: php3/functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

