1
0
Fork 0

copy internal table correctly, refix #59 which is broken by [429]

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@435 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
This commit is contained in:
Xuefer 2007-06-30 05:17:52 +00:00
parent 513ae0523a
commit 4a2a8a9ac6
2 changed files with 8 additions and 4 deletions

View File

@ -1656,7 +1656,7 @@ static void xc_request_init(TSRMLS_D) /* {{{ */
{
int i;
if (XG(internal_function_table).nTableSize == 0) {
if (!XG(internal_table_copied)) {
zend_function tmp_func;
xc_cest_t tmp_cest;
@ -1668,6 +1668,8 @@ static void xc_request_init(TSRMLS_D) /* {{{ */
zend_hash_copy(&XG(internal_function_table), CG(function_table), (copy_ctor_func_t) function_add_ref, &tmp_func, sizeof(tmp_func));
zend_hash_copy(&XG(internal_class_table), CG(class_table), (copy_ctor_func_t) xc_zend_class_add_ref, &tmp_cest, sizeof(tmp_cest));
XG(internal_table_copied) = 1;
}
if (xc_php_hcache.size && !XG(php_holds)) {
XG(php_holds) = calloc(xc_php_hcache.size, sizeof(xc_stack_t));
@ -1717,7 +1719,6 @@ void xc_init_globals(zend_xcache_globals* xcache_globals TSRMLS_DC)
zend_hash_init_ex(&xcache_globals->internal_function_table, 1, NULL, NULL, 1, 0);
zend_hash_init_ex(&xcache_globals->internal_class_table, 1, NULL, NULL, 1, 0);
}
/* }}} */
/* {{{ PHP_GSHUTDOWN_FUNCTION(xcache) */
@ -1746,8 +1747,10 @@ void xc_shutdown_globals(zend_xcache_globals* xcache_globals TSRMLS_DC)
xcache_globals->var_holds = NULL;
}
zend_hash_destroy(&xcache_globals->internal_function_table);
zend_hash_destroy(&xcache_globals->internal_class_table);
if (XG(internal_table_copied)) {
zend_hash_destroy(&xcache_globals->internal_function_table);
zend_hash_destroy(&xcache_globals->internal_class_table);
}
}
/* }}} */

View File

@ -19,6 +19,7 @@ ZEND_BEGIN_MODULE_GLOBALS(xcache)
HashTable internal_function_table;
HashTable internal_class_table;
zend_bool internal_table_copied;
ZEND_END_MODULE_GLOBALS(xcache)
ZEND_EXTERN_MODULE_GLOBALS(xcache)