cvs: php4(PHP_4_0_7) /ext/pgsql pgsql.c php_pgsql.h

From: Date: Wed, 26 Sep 2001 21:47:18 +0000
Subject: cvs: php4(PHP_4_0_7) /ext/pgsql pgsql.c php_pgsql.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-7578@lists.php.net to get a copy of this message
zeev Wed Sep 26 17:47:18 2001 EDT Modified files: (Branch: PHP_4_0_7) /php4/ext/pgsql pgsql.c php_pgsql.h Log: MFH Index: php4/ext/pgsql/pgsql.c diff -u php4/ext/pgsql/pgsql.c:1.126 php4/ext/pgsql/pgsql.c:1.126.2.1 --- php4/ext/pgsql/pgsql.c:1.126 Mon Aug 13 12:13:19 2001 +++ php4/ext/pgsql/pgsql.c Wed Sep 26 17:47:18 2001 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pgsql.c,v 1.126 2001/08/13 16:13:19 andi Exp $ */ +/* $Id: pgsql.c,v 1.126.2.1 2001/09/26 21:47:18 zeev Exp $ */ #include <stdlib.h> @@ -160,25 +160,22 @@ PQfinish(link); PGG(num_persistent)--; PGG(num_links)--; - if(PGG(last_notice) != NULL) { - efree(PGG(last_notice)); - } } /* }}} */ /* {{{ _notice_handler */ -static void -_notice_handler(void *arg, const char *message) +static void _notice_handler(void *arg, const char *message) { TSRMLS_FETCH(); if (! PGG(ignore_notices)) { php_log_err((char *) message TSRMLS_CC); - if (PGG(last_notice) != NULL) { + if (PGG(last_notice)) { efree(PGG(last_notice)); } - PGG(last_notice) = estrdup(message); + PGG(last_notice_len) = strlen(message); + PGG(last_notice) = estrndup(message, PGG(last_notice_len)); } } /* }}} */ @@ -237,7 +234,6 @@ { PGG(num_persistent) = 0; PGG(ignore_notices) = 0; - PGG(last_notice) = NULL; } /* }}} */ @@ -283,6 +279,7 @@ { PGG(default_link)=-1; PGG(num_links) = PGG(num_persistent); + PGG(last_notice) = NULL; return SUCCESS; } /* }}} */ @@ -291,6 +288,9 @@ */ PHP_RSHUTDOWN_FUNCTION(pgsql) { + if (PGG(last_notice)) { + efree(PGG(last_notice)); + } zend_hash_apply(&EG(persistent_list), (apply_func_t) _rollback_transactions TSRMLS_CC); return SUCCESS; } @@ -923,10 +923,10 @@ Returns the last notice set by the backend */ PHP_FUNCTION(pg_last_notice) { - if (PGG(last_notice) == NULL) { - RETURN_FALSE; + if (PGG(last_notice)) { + RETURN_STRINGL(PGG(last_notice), PGG(last_notice_len), 0); } else { - RETURN_STRING(PGG(last_notice),0); + RETURN_FALSE; } } /* }}} */ Index: php4/ext/pgsql/php_pgsql.h diff -u php4/ext/pgsql/php_pgsql.h:1.32 php4/ext/pgsql/php_pgsql.h:1.32.2.1 --- php4/ext/pgsql/php_pgsql.h:1.32 Sat Jul 28 07:36:09 2001 +++ php4/ext/pgsql/php_pgsql.h Wed Sep 26 17:47:18 2001 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pgsql.h,v 1.32 2001/07/28 11:36:09 zeev Exp $ */ +/* $Id: php_pgsql.h,v 1.32.2.1 2001/09/26 21:47:18 zeev Exp $ */ #ifndef PHP_PGSQL_H #define PHP_PGSQL_H @@ -123,6 +123,7 @@ int le_lofp,le_string; int ignore_notices; char *last_notice; + uint last_notice_len; } php_pgsql_globals;

« previous php.cvs (#7578) next »