From: Thies C. Arntzen Date: Thu, 7 Oct 1999 12:20:40 +0000 (+0000) Subject: added zval_del_ref() function X-Git-Tag: php-4.0b3_RC2~279 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f35244454163db88f24507168a5e9bbb06b3d456;p=php added zval_del_ref() function --- diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index da3fedb505..6d5452c94e 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -89,14 +89,22 @@ ZEND_API int _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC) } +void zval_del_ref(zval **p) +{ + (*p)->refcount--; + if ((*p)->refcount==0) { + zval_dtor(*p); + efree(*p); + } +} + + void zval_add_ref(zval **p) { (*p)->refcount++; } - - ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC) { switch (zvalue->type) { diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h index cdfa1c4eca..ce1d7f06d5 100644 --- a/Zend/zend_variables.h +++ b/Zend/zend_variables.h @@ -49,6 +49,7 @@ END_EXTERN_C() void zval_add_ref(zval **p); +void zval_del_ref(zval **p); #define PVAL_DESTRUCTOR (int (*)(void *)) zval_dtor_wrapper #define PVAL_PTR_DTOR (int (*)(void *)) zval_ptr_dtor_wrapper