summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2010-08-12 14:17:31 +0000
committerAndrey Hristov <andrey@php.net>2010-08-12 14:17:31 +0000
commit8409cb44b25f90c8df670e946018fb6209c5c1a2 (patch)
treed758703347b5fb573476a630f8111a9ded0e8e89
parent6fc06f265ee07113b5a00c96eeb2aff43b896b2b (diff)
downloadphp-git-8409cb44b25f90c8df670e946018fb6209c5c1a2.tar.gz
Make this function static, as it is used only in this file.
Add additional comment about how it works.
-rw-r--r--ext/mysqlnd/mysqlnd_result.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c
index 4d4fbd296a..bc095e27a0 100644
--- a/ext/mysqlnd/mysqlnd_result.c
+++ b/ext/mysqlnd/mysqlnd_result.c
@@ -86,12 +86,11 @@ MYSQLND_METHOD(mysqlnd_res, initialize_result_set_rest)(MYSQLND_RES * const resu
/* }}} */
-
/* {{{ mysqlnd_palloc_zval_ptr_dtor */
+static
void mysqlnd_palloc_zval_ptr_dtor(zval **zv, enum_mysqlnd_res_type type, zend_bool * copy_ctor_called TSRMLS_DC)
{
DBG_ENTER("mysqlnd_palloc_zval_ptr_dtor");
- *copy_ctor_called = FALSE;
/*
This zval is not from the cache block.
@@ -99,6 +98,7 @@ void mysqlnd_palloc_zval_ptr_dtor(zval **zv, enum_mysqlnd_res_type type, zend_bo
because the zvals from the cache are owned by it.
*/
if (type == MYSQLND_RES_PS_BUF || type == MYSQLND_RES_PS_UNBUF) {
+ *copy_ctor_called = FALSE;
; /* do nothing, zval_ptr_dtor will do the job*/
} else if (Z_REFCOUNT_PP(zv) > 1) {
/*
@@ -120,6 +120,12 @@ void mysqlnd_palloc_zval_ptr_dtor(zval **zv, enum_mysqlnd_res_type type, zend_bo
}
*copy_ctor_called = TRUE;
} else {
+ /*
+ noone but us point to this, so we can safely ZVAL_NULL the zval,
+ so Zend does not try to free what the zval points to - which is
+ in result set buffers
+ */
+ *copy_ctor_called = FALSE;
if (Z_TYPE_PP(zv) == IS_STRING) {
ZVAL_NULL(*zv);
}