From e221e7379ed34d33521dab1e3e6a93948df84aed Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 30 Nov 2017 16:23:15 +0300 Subject: [PATCH] Avoid function duplication --- ext/opcache/ZendAccelerator.c | 7 +------ ext/opcache/zend_accelerator_util_funcs.c | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 559322b088..2a50b59eed 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -2499,15 +2499,10 @@ static void accel_globals_ctor(zend_accel_globals *accel_globals) accel_gen_system_id(); } -static void accel_globals_internal_func_dtor(zval *zv) -{ - free(Z_PTR_P(zv)); -} - static void accel_globals_dtor(zend_accel_globals *accel_globals) { if (accel_globals->function_table.nTableSize) { - accel_globals->function_table.pDestructor = accel_globals_internal_func_dtor; + accel_globals->function_table.pDestructor = NULL; zend_hash_destroy(&accel_globals->function_table); } } diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index f2ac334e47..b914d23463 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -143,7 +143,7 @@ void zend_accel_copy_internal_functions(void) ZEND_HASH_FOREACH_STR_KEY_VAL(CG(function_table), key, val) { zend_internal_function *function = Z_PTR_P(val); if (function->type == ZEND_INTERNAL_FUNCTION) { - zend_hash_update_mem(&ZCG(function_table), key, function, sizeof(zend_internal_function)); + zend_hash_add_new_ptr(&ZCG(function_table), key, function); } } ZEND_HASH_FOREACH_END(); ZCG(internal_functions_count) = zend_hash_num_elements(&ZCG(function_table)); -- 2.50.1