Permalink
Browse files

- Stop passing list/plist to internal functions

- Add a typedef for the pCopyConstructor function pointer
- Minor hacks
  • Loading branch information...
1 parent 5ac1ee4 commit 9f51f154aa5e40baabd3b605675edef5772778a8 @zsuraski zsuraski committed Feb 5, 2000
Showing with 27 additions and 22 deletions.
  1. +1 −1 Zend/zend.c
  2. +2 −2 Zend/zend.h
  3. +7 −3 Zend/zend_API.c
  4. +3 −3 Zend/zend_compile.c
  5. +1 −1 Zend/zend_constants.c
  6. +2 −2 Zend/zend_execute.c
  7. +1 −1 Zend/zend_execute_API.c
  8. +2 −2 Zend/zend_hash.c
  9. +4 −3 Zend/zend_hash.h
  10. +2 −2 Zend/zend_modules.h
  11. +2 −2 Zend/zend_variables.c
View
@@ -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;
}
View
@@ -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
View
@@ -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);
}
View
@@ -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;
View
@@ -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));
}
View
@@ -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 @@ binary_assign_op_addr: {
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--;
}
View
@@ -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);
View
@@ -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;
View
@@ -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);
View
@@ -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
View
@@ -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;
}

0 comments on commit 9f51f15

Please sign in to comment.