]> granicus.if.org Git - php/commitdiff
Use zval_ptr_dtor() to free variables as soon as they hit refcount of 0.
authorZeev Suraski <zeev@php.net>
Sun, 15 Feb 2004 12:58:19 +0000 (12:58 +0000)
committerZeev Suraski <zeev@php.net>
Sun, 15 Feb 2004 12:58:19 +0000 (12:58 +0000)
Note:  You should not be using ZVAL_DELREF() in day to day usage.  Instead,
       you should use zval_ptr_dtor().  Use ZVAL_DELREF() only if you're
       messing with the refcount directly and know what you're doing.
Note #2:  For clarity, if you want to initialize a new zval with a refcount
          of 0, it's best to do that directly, instead of using ZVAL_DELREF
          after allocating the zval...

ext/com_dotnet/com_saproxy.c
ext/libxml/libxml.c
ext/mysqli/mysqli.c
ext/session/session.c

index 2dbde1415d0f04e7e4848fbc00f520d7f59570d2..78e9f622ed5d086dc787406343253b43c401e56c 100644 (file)
@@ -265,7 +265,7 @@ static void saproxy_free_storage(void *object TSRMLS_DC)
 {
        php_com_saproxy *proxy = (php_com_saproxy *)object;
 
-       ZVAL_DELREF(proxy->zobj);
+       zval_ptr_dtor(&proxy->zobj);
        efree(proxy->indices);
        efree(proxy);
 }
@@ -325,7 +325,7 @@ static void saproxy_iter_dtor(zend_object_iterator *iter TSRMLS_DC)
 {
        php_com_saproxy_iter *I = (php_com_saproxy_iter*)iter->data;
 
-       ZVAL_DELREF(I->proxy_obj);
+       zval_ptr_dtor(&I->proxy_obj);
 
        efree(I->indices);
        efree(I);
index 7545b69f3ff98920b613653d88c3de64642ab9e0..148337ea4b18cebbb09e093538465ba865e30267 100644 (file)
@@ -466,7 +466,7 @@ PHP_FUNCTION(libxml_set_streams_context)
                return;
        }
        if (LIBXML(stream_context)) {
-               ZVAL_DELREF(LIBXML(stream_context));
+               zval_ptr_dtor(&LIBXML(stream_context));
                LIBXML(stream_context) = NULL;
        }
        ZVAL_ADDREF(arg);
index 9bf75d9bbb52cbab2f19ed361be8ec34fa4d8b03..4befc71e6459d8ae7690df23df036f93bf34f1de 100644 (file)
@@ -70,7 +70,7 @@ void php_free_stmt_bind_buffer(BIND_BUFFER bbuf, int type)
                        }
                }
                if (bbuf.vars[i]) {
-                       ZVAL_DELREF(bbuf.vars[i]);
+                       zval_ptr_dtor(&bbuf.vars[i]);
                }       
        }
 
index dcb45d0e81fd2da40f7cd5d90de4587646bea709..27874f72ee9759a6544d8ebfb05f2d231d9e456d 100644 (file)
@@ -281,7 +281,7 @@ void php_add_session_var(char *name, size_t namelen TSRMLS_DC)
                        zval *empty_var;
 
                        ALLOC_INIT_ZVAL(empty_var); /* this sets refcount to 1 */
-                       ZVAL_DELREF(empty_var); /* our module does not maintain a ref */
+                       empty_var->refcount = 0; /* our module does not maintain a ref */
                        /* The next call will increase refcount by NR_OF_SYM_TABLES==2 */
                        zend_set_hash_symbol(empty_var, name, namelen, 1, 2, Z_ARRVAL_P(PS(http_session_vars)), &EG(symbol_table));
                } else if (sym_global == NULL) {