]> granicus.if.org Git - php/commitdiff
- Stop passing list/plist to internal functions
authorZeev Suraski <zeev@php.net>
Sat, 5 Feb 2000 15:11:24 +0000 (15:11 +0000)
committerZeev Suraski <zeev@php.net>
Sat, 5 Feb 2000 15:11:24 +0000 (15:11 +0000)
- Add a typedef for the pCopyConstructor function pointer
- Minor hacks

Zend/zend.c
Zend/zend.h
Zend/zend_API.c
Zend/zend_compile.c
Zend/zend_constants.c
Zend/zend_execute.c
Zend/zend_execute_API.c
Zend/zend_hash.c
Zend/zend_hash.h
Zend/zend_modules.h
Zend/zend_variables.c

index d5c4e2f04dcccc59ecd64c924453ce393f389115..41d038402fccd11af0b055b66683ca06c5420303 100644 (file)
@@ -253,7 +253,7 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals)
 
        compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
        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));
+       zend_hash_copy(compiler_globals->class_table, global_class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry));
 
        compiler_globals->extended_info = 0;
 }
index 272d9f19fe73107a59b18b20493d2943de4d4451..d1035857f87d614839fcd0969247203eacd9f2ee 100644 (file)
@@ -117,8 +117,8 @@ typedef unsigned char zend_bool;
 #include "zend_hash.h"
 #include "zend_llist.h"
 
-#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, HashTable *list, HashTable *plist, zval *this_ptr, int return_value_used
-#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, list, plist, this_ptr, return_value_used
+#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, zval *this_ptr, int return_value_used
+#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, this_ptr, return_value_used
 
 /*
  * zval
index 60e13ea920e18699391a6f6105979ed448e9c235..4cf4eb6e22f5e991f7c216e6ba0198b01ccffd15 100644 (file)
@@ -210,7 +210,7 @@ ZEND_API inline int object_init_ex(zval *arg, zend_class_entry *class_type)
        
        ALLOC_HASHTABLE(arg->value.obj.properties);
        zend_hash_init(arg->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
-       zend_hash_copy(arg->value.obj.properties, &class_type->default_properties, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *));
+       zend_hash_copy(arg->value.obj.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
        arg->type = IS_OBJECT;
        arg->value.obj.ce = class_type;
        return SUCCESS;
@@ -695,7 +695,9 @@ ZEND_API int zend_startup_module(zend_module_entry *module)
        if (module) {
                module->module_number = zend_next_free_module();
                if (module->module_startup_func) {
-                       if (module->module_startup_func(MODULE_PERSISTENT, module->module_number)==FAILURE) {
+                       ELS_FETCH();
+
+                       if (module->module_startup_func(MODULE_PERSISTENT, module->module_number ELS_CC)==FAILURE) {
                                zend_error(E_CORE_ERROR,"Unable to start %s module",module->name);
                                return FAILURE;
                        }
@@ -842,10 +844,12 @@ void module_destructor(zend_module_entry *module)
 int module_registry_request_startup(zend_module_entry *module)
 {
        if (module->request_startup_func) {
+               ELS_FETCH();
+
 #if 0
                zend_printf("%s:  Request startup\n",module->name);
 #endif
-               if (module->request_startup_func(module->type, module->module_number)==FAILURE) {
+               if (module->request_startup_func(module->type, module->module_number ELS_CC)==FAILURE) {
                        zend_error(E_WARNING, "request_startup() for %s module failed", module->name);
                        exit(1);
                }
index f25eb3337b9a80f1f7fa930808f972db43a659c1..1e9af037b3dd8490e9c53e63d140edc287bc8ec1 100644 (file)
@@ -1049,7 +1049,7 @@ static void function_add_ref(zend_function *function)
 
                        ALLOC_HASHTABLE(op_array->static_variables);
                        zend_hash_init(op_array->static_variables, 2, NULL, ZVAL_PTR_DTOR, 0);
-                       zend_hash_copy(op_array->static_variables, static_variables, (void (*)(void *)) zval_add_ref, (void *) &tmp_zval, sizeof(zval *));
+                       zend_hash_copy(op_array->static_variables, static_variables, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_zval, sizeof(zval *));
                }
        }
 }
@@ -1479,10 +1479,10 @@ void do_begin_class_declaration(znode *class_name, znode *parent_class_name CLS_
 
                if (zend_hash_find(CG(class_table), parent_class_name->u.constant.value.str.val, parent_class_name->u.constant.value.str.len+1, (void **) &parent_class)==SUCCESS) {
                        /* copy functions */
-                       zend_hash_copy(&CG(class_entry).function_table, &parent_class->function_table, (void (*)(void *)) function_add_ref, &tmp_zend_function, sizeof(zend_function));
+                       zend_hash_copy(&CG(class_entry).function_table, &parent_class->function_table, (copy_ctor_func_t) function_add_ref, &tmp_zend_function, sizeof(zend_function));
 
                        /* copy default properties */
-                       zend_hash_copy(&CG(class_entry).default_properties, &parent_class->default_properties, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *));
+                       zend_hash_copy(&CG(class_entry).default_properties, &parent_class->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
 
                        CG(class_entry).parent = parent_class;
 
index 0b95f9f66b0c854d7b1f615a3fac18b2cfb68827..c3a1d0b7ba91ef143b48e508654aa8778e0e09b8 100644 (file)
@@ -45,7 +45,7 @@ void zend_copy_constants(HashTable *target, HashTable *source)
 {
        zend_constant tmp_constant;
 
-       zend_hash_copy(target, source, (void (*)(void *)) copy_zend_constant, &tmp_constant, sizeof(zend_constant));
+       zend_hash_copy(target, source, (copy_ctor_func_t) copy_zend_constant, &tmp_constant, sizeof(zend_constant));
 }
 
 
index 7b4e912af7ae0dfbd9186658e900a4e29ab00b52..10468da0e1ae350d2f2469de1b3e972a1b40e7b7 100644 (file)
@@ -930,7 +930,7 @@ static void call_overloaded_function(int arg_count, zval *return_value, HashTabl
        zend_property_reference *property_reference;
 
        zend_stack_top(&EG(overloaded_objects_stack), (void **) &property_reference);
-       (property_reference->object)->value.obj.ce->handle_function_call(arg_count, return_value, list, plist, property_reference->object, 1, property_reference);
+       (property_reference->object)->value.obj.ce->handle_function_call(arg_count, return_value, property_reference->object, 1, property_reference);
        zend_llist_destroy(&property_reference->elements_list);
 
        zend_stack_del_top(&EG(overloaded_objects_stack));
@@ -1534,7 +1534,7 @@ do_fcall_common:
                                        if (function_state.function->type==ZEND_INTERNAL_FUNCTION) {    
                                                ALLOC_ZVAL(Ts[opline->result.u.var].var.ptr);
                                                INIT_ZVAL(*(Ts[opline->result.u.var].var.ptr));
-                                               ((zend_internal_function *) function_state.function)->handler(opline->extended_value, Ts[opline->result.u.var].var.ptr, &EG(regular_list), &EG(persistent_list), object.ptr, return_value_used);
+                                               ((zend_internal_function *) function_state.function)->handler(opline->extended_value, Ts[opline->result.u.var].var.ptr, object.ptr, return_value_used);
                                                if (object.ptr) {
                                                        object.ptr->refcount--;
                                                }
index a5e1d0c9967eebf3c1f1bdb887f310ea7bdcee46..877ce8082cdb45c51d46781fa12f1bd9714008b2 100644 (file)
@@ -415,7 +415,7 @@ int call_user_function_ex(HashTable *function_table, zval *object, zval *functio
                EG(opline_ptr) = original_opline_ptr;
        } else {
                ALLOC_INIT_ZVAL(*retval_ptr_ptr);
-               ((zend_internal_function *) function_state.function)->handler(param_count, *retval_ptr_ptr, &EG(regular_list), &EG(persistent_list), object, 1);
+               ((zend_internal_function *) function_state.function)->handler(param_count, *retval_ptr_ptr, object, 1);
                INIT_PZVAL(*retval_ptr_ptr);
        }
        zend_ptr_stack_clear_multiple(ELS_C);
index 921fa00a0599f9c1363f0623548612420e69ce72..c84cba535b2b0118290e896a3fdd59199bcee5bc 100644 (file)
@@ -744,7 +744,7 @@ ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, int (*destruct)(void
 
 
 
-ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, void (*pCopyConstructor) (void *pData), void *tmp, uint size)
+ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size)
 {
        Bucket *p;
 
@@ -768,7 +768,7 @@ ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, void (*pCopyC
 }
 
 
-ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, void (*pCopyConstructor) (void *pData), void *tmp, uint size, int overwrite)
+ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite)
 {
        Bucket *p;
        void *t;
index 5d512b70ef01fea0b85237317c14fdedd8f8b150..4ec035e26b43d9bcdfefd9cbb894d8745aec670d 100644 (file)
@@ -38,6 +38,7 @@ typedef int  (*compare_func_t)(const void *, const void *);
 typedef void (*sort_func_t)(void *, size_t, register size_t, compare_func_t);
 typedef void (*dtor_func_t)(void *pDest);
 typedef ulong (*hash_func_t)(char *arKey, uint nKeyLength);
+typedef void (*copy_ctor_func_t)(void *pElement);
 
 struct hashtable;
 
@@ -150,10 +151,10 @@ ZEND_API void zend_hash_internal_pointer_reset(HashTable *ht);
 ZEND_API void zend_hash_internal_pointer_end(HashTable *ht);
 
 /* Copying, merging and sorting */
-ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, void (*pCopyConstructor) (void *pData), void *tmp, uint size);
-ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, void (*pCopyConstructor) (void *pData), void *tmp, uint size, int overwrite);
+ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size);
+ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite);
 ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber);
-ZEND_API int zend_hash_minmax(HashTable *ht, int (*compar) (const void *, const void *), int flag, void **pData);
+ZEND_API int zend_hash_minmax(HashTable *ht, int (*compar)(const void *, const void *), int flag, void **pData);
 
 ZEND_API int zend_hash_num_elements(HashTable *ht);
 
index b9b5ac85c58392bbc4cc1f0be944fca3154f3bf5..aa4dd4c80f2c8a65fe5f05b4dcd2fb29913f5977 100644 (file)
@@ -21,8 +21,8 @@
 #ifndef _MODULES_H
 #define _MODULES_H
 
-#define INIT_FUNC_ARGS         int type, int module_number
-#define INIT_FUNC_ARGS_PASSTHRU        type, module_number
+#define INIT_FUNC_ARGS         int type, int module_number ELS_DC
+#define INIT_FUNC_ARGS_PASSTHRU        type, module_number ELS_CC
 #define SHUTDOWN_FUNC_ARGS     int type, int module_number
 #define SHUTDOWN_FUNC_ARGS_PASSTHRU type, module_number
 #define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module
index 028f0b7cdfd58005ee6e2d11ffa329f206f7f76a..640e6e9f7265f74bb6fa420a3583f41b92d88304 100644 (file)
@@ -138,7 +138,7 @@ ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC)
                                }
                                zvalue->value.ht = (HashTable *) emalloc_rel(sizeof(HashTable));
                                zend_hash_init(zvalue->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0);
-                               zend_hash_copy(zvalue->value.ht, original_ht, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *));
+                               zend_hash_copy(zvalue->value.ht, original_ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
                        }
                        break;
                case IS_OBJECT: {
@@ -147,7 +147,7 @@ ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC)
 
                                zvalue->value.obj.properties = (HashTable *) emalloc_rel(sizeof(HashTable));
                                zend_hash_init(zvalue->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
-                               zend_hash_copy(zvalue->value.obj.properties, original_ht, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *));
+                               zend_hash_copy(zvalue->value.obj.properties, original_ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
                        }
                        break;
        }