@@ -297,18 +297,16 @@ static void php_pgsql_set_default_link(zend_object *obj)
297
297
298
298
static void _close_pgsql_plink (zend_resource * rsrc )
299
299
{
300
- if (rsrc -> ptr ) {
301
- PGconn * link = (PGconn * )rsrc -> ptr ;
302
- PGresult * res ;
300
+ PGconn * link = (PGconn * )rsrc -> ptr ;
301
+ PGresult * res ;
303
302
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 );
311
305
}
306
+ PQfinish (link );
307
+ PGG (num_persistent )-- ;
308
+ PGG (num_links )-- ;
309
+ rsrc -> ptr = NULL ;
312
310
}
313
311
314
312
static 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)
317
315
return ;
318
316
}
319
317
320
- pgsql_link_handle * link ;
321
318
zval tmp ;
319
+ pgsql_link_handle * link = (pgsql_link_handle * ) l ;
322
320
323
- link = (pgsql_link_handle * ) l ;
324
321
if (!link -> notices ) {
325
322
link -> notices = zend_new_array (1 );
326
323
}
@@ -1531,7 +1528,7 @@ PHP_FUNCTION(pg_last_notice)
1531
1528
break ;
1532
1529
case PGSQL_NOTICE_CLEAR :
1533
1530
if (notices ) {
1534
- zend_hash_clean (link -> notices );
1531
+ zend_hash_clean (notices );
1535
1532
}
1536
1533
RETURN_TRUE ;
1537
1534
break ;
@@ -2524,13 +2521,9 @@ PHP_FUNCTION(pg_lo_open)
2524
2521
RETURN_THROWS ();
2525
2522
}
2526
2523
2527
- object_init_ex (return_value , pgsql_lob_ce );
2528
- pgsql_lofp = Z_PGSQL_LOB_P (return_value );
2529
-
2530
2524
if ((pgsql_lofd = lo_open (pgsql , oid , pgsql_mode )) == -1 ) {
2531
2525
if (create ) {
2532
2526
if ((oid = lo_creat (pgsql , INV_READ |INV_WRITE )) == 0 ) {
2533
- zval_ptr_dtor (return_value );
2534
2527
php_error_docref (NULL , E_WARNING , "Unable to create PostgreSQL large object" );
2535
2528
RETURN_FALSE ;
2536
2529
} else {
@@ -2541,24 +2534,19 @@ PHP_FUNCTION(pg_lo_open)
2541
2534
php_error_docref (NULL , E_WARNING , "Unable to open PostgreSQL large object" );
2542
2535
}
2543
2536
2544
- zval_ptr_dtor (return_value );
2545
2537
RETURN_FALSE ;
2546
- } else {
2547
- pgsql_lofp -> conn = pgsql ;
2548
- pgsql_lofp -> lofd = pgsql_lofd ;
2549
- return ;
2550
2538
}
2551
2539
}
2552
2540
} else {
2553
- zval_ptr_dtor (return_value );
2554
2541
php_error_docref (NULL , E_WARNING , "Unable to open PostgreSQL large object" );
2555
2542
RETURN_FALSE ;
2556
2543
}
2557
- } else {
2558
- pgsql_lofp -> conn = pgsql ;
2559
- pgsql_lofp -> lofd = pgsql_lofd ;
2560
- return ;
2561
2544
}
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 ;
2562
2550
}
2563
2551
/* }}} */
2564
2552
0 commit comments