mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Encapsulate reference-counting primitives.
Prohibit direct update of GC_REFCOUNT(), GC_SET_REFCOUNT(), GC_ADDREF() and GC_DELREF() shoukf be instead. Added mactros to validate reference-counting (disabled for now). These macros are going to be used to eliminate race-condintions during reference-counting on data shared between threads.
This commit is contained in:
parent
1ab0d820da
commit
49ea143bbd
66 changed files with 408 additions and 345 deletions
|
@ -923,7 +923,7 @@ static inline char * _php_pgsql_trim_result(PGconn * pgsql, char **buf)
|
|||
*/
|
||||
static void php_pgsql_set_default_link(zend_resource *res)
|
||||
{
|
||||
GC_REFCOUNT(res)++;
|
||||
GC_ADDREF(res);
|
||||
|
||||
if (PGG(default_link) != NULL) {
|
||||
zend_list_delete(PGG(default_link));
|
||||
|
@ -1451,7 +1451,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
|||
link = (zend_resource *)index_ptr->ptr;
|
||||
if (link->ptr && (link->type == le_link || link->type == le_plink)) {
|
||||
php_pgsql_set_default_link(link);
|
||||
GC_REFCOUNT(link)++;
|
||||
GC_ADDREF(link);
|
||||
RETVAL_RES(link);
|
||||
goto cleanup;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue