From 81d901b14dd87285977ba7947a0268adb6519089 Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Fri, 9 Jul 1999 17:24:47 +0000 Subject: Step 1 in nuking the garbage collector: - Change the hash destructor to return int - Don't kill the bucket on hash_destroy if the destructor returns 0 --- Zend/zend.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Zend/zend.c') diff --git a/Zend/zend.c b/Zend/zend.c index 5f4ba6e16c..9c2b23b31f 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -203,7 +203,7 @@ static void register_standard_class() zend_standard_class_def.name = zend_strndup("stdClass", zend_standard_class_def.name_length); zend_standard_class_def.parent = NULL; zend_hash_init(&zend_standard_class_def.default_properties, 0, NULL, PVAL_PTR_DTOR, 1); - zend_hash_init(&zend_standard_class_def.function_table, 0, NULL, (void (*)(void *)) destroy_zend_function, 1); + zend_hash_init(&zend_standard_class_def.function_table, 0, NULL, ZEND_FUNCTION_DTOR, 1); zend_standard_class_def.handle_function_call = NULL; zend_standard_class_def.handle_property_get = NULL; zend_standard_class_def.handle_property_set = NULL; @@ -220,11 +220,11 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals) zend_class_entry tmp_class; compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable)); - zend_hash_init(compiler_globals->function_table, 100, NULL, (void (*)(void *)) destroy_zend_function, 1); + zend_hash_init(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1); zend_hash_copy(compiler_globals->function_table, global_function_table, NULL, &tmp_func, sizeof(zend_function)); compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable)); - zend_hash_init(compiler_globals->class_table, 10, NULL, (void (*)(void *)) destroy_zend_class, 1); + zend_hash_init(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1); zend_hash_copy(compiler_globals->class_table, global_class_table, zend_class_add_ref, &tmp_class, sizeof(zend_class_entry)); } @@ -303,10 +303,10 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions) #endif GLOBAL_FUNCTION_TABLE = (HashTable *) malloc(sizeof(HashTable)); GLOBAL_CLASS_TABLE = (HashTable *) malloc(sizeof(HashTable)); - zend_hash_init(GLOBAL_FUNCTION_TABLE, 100, NULL, (void (*)(void *)) destroy_zend_function, 1); - zend_hash_init(GLOBAL_CLASS_TABLE, 10, NULL, (void (*)(void *)) destroy_zend_class, 1); + zend_hash_init(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1); + zend_hash_init(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1); register_standard_class(); - zend_hash_init(&module_registry, 50, NULL, (void (*)(void *)) module_destructor, 1); + zend_hash_init(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1); zend_hash_init(&list_destructors, 50, NULL, NULL, 1); #ifdef ZTS -- cgit v1.2.1