andrey Thu, 12 Aug 2010 14:17:31 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=302144
Log: Make this function static, as it is used only in this file. Add additional comment about how it works. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c U php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c 2010-08-12 13:23:16 UTC (rev 302143) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c 2010-08-12 14:17:31 UTC (rev 302144) @@ -86,12 +86,11 @@ /* }}} */ - /* {{{ 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 @@ 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 @@ } *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); } Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c 2010-08-12 13:23:16 UTC (rev 302143) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c 2010-08-12 14:17:31 UTC (rev 302144) @@ -86,12 +86,11 @@ /* }}} */ - /* {{{ 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 @@ 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 @@ } *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); }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php