From 49ea143bbd8d0bfcd393d0b5308a5d7833fc087c Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 27 Oct 2017 01:28:58 +0300 Subject: 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. --- sapi/phpdbg/phpdbg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sapi/phpdbg/phpdbg.c') diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index 5ef6b59d64..b212679ab9 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -580,10 +580,10 @@ static PHP_FUNCTION(phpdbg_get_executable) zend_hash_add_empty_element(files, zval_get_string(filename)); } ZEND_HASH_FOREACH_END(); } else { - GC_REFCOUNT(files)++; + GC_ADDREF(files); } } else { - GC_REFCOUNT(files)++; + GC_ADDREF(files); } array_init(return_value); @@ -632,7 +632,7 @@ static PHP_FUNCTION(phpdbg_get_executable) } } ZEND_HASH_FOREACH_END(); - if (!--GC_REFCOUNT(files)) { + if (!GC_DELREF(files)) { zend_hash_destroy(files); } } -- cgit v1.2.1