summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-02-05 15:11:24 +0000
committerZeev Suraski <zeev@php.net>2000-02-05 15:11:24 +0000
commit9f51f154aa5e40baabd3b605675edef5772778a8 (patch)
tree913caedad44228494f4fd13c7ea9b337d499660f /Zend
parent5ac1ee403bed25e0a0b6c515991692df07c41ddb (diff)
downloadphp-git-9f51f154aa5e40baabd3b605675edef5772778a8.tar.gz
- Stop passing list/plist to internal functions
- Add a typedef for the pCopyConstructor function pointer - Minor hacks
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend.c2
-rw-r--r--Zend/zend.h4
-rw-r--r--Zend/zend_API.c10
-rw-r--r--Zend/zend_compile.c6
-rw-r--r--Zend/zend_constants.c2
-rw-r--r--Zend/zend_execute.c4
-rw-r--r--Zend/zend_execute_API.c2
-rw-r--r--Zend/zend_hash.c4
-rw-r--r--Zend/zend_hash.h7
-rw-r--r--Zend/zend_modules.h4
-rw-r--r--Zend/zend_variables.c4
11 files changed, 27 insertions, 22 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index d5c4e2f04d..41d038402f 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -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;
}
diff --git a/Zend/zend.h b/Zend/zend.h
index 272d9f19fe..d1035857f8 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -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
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 60e13ea920..4cf4eb6e22 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -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);
}
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index f25eb3337b..1e9af037b3 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -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;
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
index 0b95f9f66b..c3a1d0b7ba 100644
--- a/Zend/zend_constants.c
+++ b/Zend/zend_constants.c
@@ -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));
}
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 7b4e912af7..10468da0e1 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -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--;
}
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index a5e1d0c996..877ce8082c 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -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);
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index 921fa00a05..c84cba535b 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -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;
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index 5d512b70ef..4ec035e26b 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -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);
diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h
index b9b5ac85c5..aa4dd4c80f 100644
--- a/Zend/zend_modules.h
+++ b/Zend/zend_modules.h
@@ -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
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c
index 028f0b7cdf..640e6e9f72 100644
--- a/Zend/zend_variables.c
+++ b/Zend/zend_variables.c
@@ -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;
}