@@ -297,18 +297,16 @@ static void php_pgsql_set_default_link(zend_object *obj)
297297
298298static void _close_pgsql_plink (zend_resource * rsrc )
299299{
300- if (rsrc -> ptr ) {
301- PGconn * link = (PGconn * )rsrc -> ptr ;
302- PGresult * res ;
300+ PGconn * link = (PGconn * )rsrc -> ptr ;
301+ PGresult * res ;
303302
304- while ((res = PQgetResult (link ))) {
305- PQclear (res );
306- }
307- PQfinish (link );
308- PGG (num_persistent )-- ;
309- PGG (num_links )-- ;
310- rsrc -> ptr = NULL ;
303+ while ((res = PQgetResult (link ))) {
304+ PQclear (res );
311305 }
306+ PQfinish (link );
307+ PGG (num_persistent )-- ;
308+ PGG (num_links )-- ;
309+ rsrc -> ptr = NULL ;
312310}
313311
314312static void _php_pgsql_notice_handler (void * l , const char * message )
@@ -317,10 +315,9 @@ static void _php_pgsql_notice_handler(void *l, const char *message)
317315 return ;
318316 }
319317
320- pgsql_link_handle * link ;
321318 zval tmp ;
319+ pgsql_link_handle * link = (pgsql_link_handle * ) l ;
322320
323- link = (pgsql_link_handle * ) l ;
324321 if (!link -> notices ) {
325322 link -> notices = zend_new_array (1 );
326323 }
@@ -1531,7 +1528,7 @@ PHP_FUNCTION(pg_last_notice)
15311528 break ;
15321529 case PGSQL_NOTICE_CLEAR :
15331530 if (notices ) {
1534- zend_hash_clean (link -> notices );
1531+ zend_hash_clean (notices );
15351532 }
15361533 RETURN_TRUE ;
15371534 break ;
@@ -2524,13 +2521,9 @@ PHP_FUNCTION(pg_lo_open)
25242521 RETURN_THROWS ();
25252522 }
25262523
2527- object_init_ex (return_value , pgsql_lob_ce );
2528- pgsql_lofp = Z_PGSQL_LOB_P (return_value );
2529-
25302524 if ((pgsql_lofd = lo_open (pgsql , oid , pgsql_mode )) == -1 ) {
25312525 if (create ) {
25322526 if ((oid = lo_creat (pgsql , INV_READ |INV_WRITE )) == 0 ) {
2533- zval_ptr_dtor (return_value );
25342527 php_error_docref (NULL , E_WARNING , "Unable to create PostgreSQL large object" );
25352528 RETURN_FALSE ;
25362529 } else {
@@ -2541,24 +2534,19 @@ PHP_FUNCTION(pg_lo_open)
25412534 php_error_docref (NULL , E_WARNING , "Unable to open PostgreSQL large object" );
25422535 }
25432536
2544- zval_ptr_dtor (return_value );
25452537 RETURN_FALSE ;
2546- } else {
2547- pgsql_lofp -> conn = pgsql ;
2548- pgsql_lofp -> lofd = pgsql_lofd ;
2549- return ;
25502538 }
25512539 }
25522540 } else {
2553- zval_ptr_dtor (return_value );
25542541 php_error_docref (NULL , E_WARNING , "Unable to open PostgreSQL large object" );
25552542 RETURN_FALSE ;
25562543 }
2557- } else {
2558- pgsql_lofp -> conn = pgsql ;
2559- pgsql_lofp -> lofd = pgsql_lofd ;
2560- return ;
25612544 }
2545+
2546+ object_init_ex (return_value , pgsql_lob_ce );
2547+ pgsql_lofp = Z_PGSQL_LOB_P (return_value );
2548+ pgsql_lofp -> conn = pgsql ;
2549+ pgsql_lofp -> lofd = pgsql_lofd ;
25622550}
25632551/* }}} */
25642552
0 commit comments