summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThies C. Arntzen <thies@php.net>1999-10-07 12:20:40 +0000
committerThies C. Arntzen <thies@php.net>1999-10-07 12:20:40 +0000
commitf35244454163db88f24507168a5e9bbb06b3d456 (patch)
tree32360606509fe0029b57f6954588ecd9c54c1e50
parentd480d23e9704ca7f9c96a1bc2692f3d0187f2bcd (diff)
downloadphp-git-f35244454163db88f24507168a5e9bbb06b3d456.tar.gz
added zval_del_ref() function
-rw-r--r--Zend/zend_variables.c12
-rw-r--r--Zend/zend_variables.h1
2 files changed, 11 insertions, 2 deletions
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