summaryrefslogtreecommitdiff
path: root/ext/pgsql/pgsql.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2017-10-27 01:28:58 +0300
committerDmitry Stogov <dmitry@zend.com>2017-10-27 01:28:58 +0300
commit49ea143bbd8d0bfcd393d0b5308a5d7833fc087c (patch)
tree071b08e8067e5a6a1e9726e3d76dfe81cc42d6b0 /ext/pgsql/pgsql.c
parent1ab0d820dabc612b7d371d6ed524f60f68101d0f (diff)
downloadphp-git-49ea143bbd8d0bfcd393d0b5308a5d7833fc087c.tar.gz
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.
Diffstat (limited to 'ext/pgsql/pgsql.c')
-rw-r--r--ext/pgsql/pgsql.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index d9cb3ec301..f1bc779cfe 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -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 {