summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2014-05-25 19:56:51 +0800
committerXinchen Hui <laruence@php.net>2014-05-25 19:56:51 +0800
commit0175d994c0f22a22c20d6b6ae04cd92355277d91 (patch)
tree2cb51949c84f3cf69ce1a3410c3bd34f6da97806
parentc2082ece52bcb5343ae0feb460807596cd79d691 (diff)
downloadphp-git-0175d994c0f22a22c20d6b6ae04cd92355277d91.tar.gz
Fixed apply_func_arg_t, and it's better not using cast (compiler friendly)
-rw-r--r--Zend/zend_API.c12
-rw-r--r--Zend/zend_builtin_functions.c4
-rw-r--r--Zend/zend_compile.c9
-rw-r--r--Zend/zend_execute_API.c7
-rw-r--r--Zend/zend_ini.c10
-rw-r--r--Zend/zend_list.c4
6 files changed, 26 insertions, 20 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index a52abe3544..01cdefcc13 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -1095,7 +1095,7 @@ ZEND_API int _array_init(zval *arg, uint size ZEND_FILE_LINE_DC) /* {{{ */
}
/* }}} */
-static int zend_merge_property(zval *value TSRMLS_DC, int num_args, va_list args, const zend_hash_key *hash_key) /* {{{ */
+static int zend_merge_property(zval *value TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
{
/* which name should a numeric property have ? */
if (hash_key->key) {
@@ -1119,7 +1119,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro
zend_class_entry *old_scope = EG(scope);
EG(scope) = Z_OBJCE_P(obj);
- zend_hash_apply_with_arguments(properties TSRMLS_CC, (apply_func_args_t)zend_merge_property, 2, obj, obj_ht);
+ zend_hash_apply_with_arguments(properties TSRMLS_CC, zend_merge_property, 2, obj, obj_ht);
EG(scope) = old_scope;
if (destroy_ht) {
@@ -2453,9 +2453,11 @@ ZEND_API int zend_get_module_started(const char *module_name) /* {{{ */
}
/* }}} */
-static int clean_module_class(const zend_class_entry **ce, int *module_number TSRMLS_DC) /* {{{ */
+static int clean_module_class(zval *el, void *arg TSRMLS_DC) /* {{{ */
{
- if ((*ce)->type == ZEND_INTERNAL_CLASS && (*ce)->info.internal.module->module_number == *module_number) {
+ zend_class_entry *ce = (zend_class_entry *)Z_PTR_P(el);
+ int module_number = *(int *)arg;
+ if (ce->type == ZEND_INTERNAL_CLASS && ce->info.internal.module->module_number == module_number) {
return ZEND_HASH_APPLY_REMOVE;
} else {
return ZEND_HASH_APPLY_KEEP;
@@ -2465,7 +2467,7 @@ static int clean_module_class(const zend_class_entry **ce, int *module_number TS
static void clean_module_classes(int module_number TSRMLS_DC) /* {{{ */
{
- zend_hash_apply_with_argument(EG(class_table), (apply_func_arg_t) clean_module_class, (void *) &module_number TSRMLS_CC);
+ zend_hash_apply_with_argument(EG(class_table), clean_module_class, (void *) &module_number TSRMLS_CC);
}
/* }}} */
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 77743fbd32..b207d698f8 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -1873,7 +1873,7 @@ ZEND_FUNCTION(get_loaded_extensions)
if (zendext) {
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t)add_zendext_info, return_value TSRMLS_CC);
} else {
- zend_hash_apply_with_argument(&module_registry, (apply_func_arg_t)add_extension_info, return_value TSRMLS_CC);
+ zend_hash_apply_with_argument(&module_registry, add_extension_info, return_value TSRMLS_CC);
}
}
/* }}} */
@@ -1939,7 +1939,7 @@ ZEND_FUNCTION(get_defined_constants)
efree(module_names);
efree(modules);
} else {
- zend_hash_apply_with_argument(EG(zend_constants), (apply_func_arg_t)add_constant_info, return_value TSRMLS_CC);
+ zend_hash_apply_with_argument(EG(zend_constants), add_constant_info, return_value TSRMLS_CC);
}
}
/* }}} */
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 20e4b5f341..ed1b980633 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -4101,9 +4101,10 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
}
/* }}} */
-static int zend_fixup_trait_method(zval *zv, zend_class_entry *ce TSRMLS_DC) /* {{{ */
+static int zend_fixup_trait_method(zval *zv, void *arg TSRMLS_DC) /* {{{ */
{
zend_function *fn = Z_PTR_P(zv);
+ zend_class_entry *ce = (zend_class_entry *)arg;
if ((fn->common.scope->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
@@ -4368,15 +4369,15 @@ static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{
zend_traits_compile_exclude_table(&exclude_table, ce->trait_precedences, ce->traits[i]);
/* copies functions, applies defined aliasing, and excludes unused trait methods */
- zend_hash_apply_with_arguments(&ce->traits[i]->function_table TSRMLS_CC, (apply_func_args_t)zend_traits_copy_functions, 3, ce, &overriden, &exclude_table);
+ zend_hash_apply_with_arguments(&ce->traits[i]->function_table TSRMLS_CC, zend_traits_copy_functions, 3, ce, &overriden, &exclude_table);
zend_hash_destroy(&exclude_table);
} else {
- zend_hash_apply_with_arguments(&ce->traits[i]->function_table TSRMLS_CC, (apply_func_args_t)zend_traits_copy_functions, 3, ce, &overriden, NULL);
+ zend_hash_apply_with_arguments(&ce->traits[i]->function_table TSRMLS_CC, zend_traits_copy_functions, 3, ce, &overriden, NULL);
}
}
- zend_hash_apply_with_argument(&ce->function_table, (apply_func_arg_t)zend_fixup_trait_method, ce TSRMLS_CC);
+ zend_hash_apply_with_argument(&ce->function_table, zend_fixup_trait_method, ce TSRMLS_CC);
if (overriden) {
zend_hash_destroy(overriden);
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index a891f97e08..2b62f2e844 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -1541,9 +1541,10 @@ typedef struct _zend_abstract_info {
int ctor;
} zend_abstract_info;
-static int zend_verify_abstract_class_function(zval *zv, zend_abstract_info *ai TSRMLS_DC) /* {{{ */
+static int zend_verify_abstract_class_function(zval *zv, void *arg TSRMLS_DC) /* {{{ */
{
- zend_function *fn = Z_PTR_P(zv);
+ zend_function *fn = (zend_function *)Z_PTR_P(zv);
+ zend_abstract_info *ai = (zend_abstract_info *)arg;
if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
if (ai->cnt < MAX_ABSTRACT_INFO_CNT) {
@@ -1571,7 +1572,7 @@ void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC) /* {{{ */
if ((ce->ce_flags & ZEND_ACC_IMPLICIT_ABSTRACT_CLASS) && !(ce->ce_flags & ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {
memset(&ai, 0, sizeof(ai));
- zend_hash_apply_with_argument(&ce->function_table, (apply_func_arg_t) zend_verify_abstract_class_function, &ai TSRMLS_CC);
+ zend_hash_apply_with_argument(&ce->function_table, zend_verify_abstract_class_function, &ai TSRMLS_CC);
if (ai.cnt) {
zend_error(E_ERROR, "Class %s contains %d abstract method%s and must therefore be declared abstract or implement the remaining methods (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")",
diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c
index ca4e4d7863..6f4cd4fd38 100644
--- a/Zend/zend_ini.c
+++ b/Zend/zend_ini.c
@@ -34,8 +34,9 @@ static HashTable *registered_zend_ini_directives;
/*
* hash_apply functions
*/
-static int zend_remove_ini_entries(zend_ini_entry *ini_entry, int *module_number TSRMLS_DC) /* {{{ */
+static int zend_remove_ini_entries(zval *el, int *module_number TSRMLS_DC) /* {{{ */
{
+ zend_ini_entry *ini_entry = (zend_ini_entry *)Z_PTR_P(el);
if (ini_entry->module_number == *module_number) {
return 1;
} else {
@@ -224,13 +225,14 @@ ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int modu
ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC) /* {{{ */
{
- zend_hash_apply_with_argument(registered_zend_ini_directives, (apply_func_arg_t) zend_remove_ini_entries, (void *) &module_number TSRMLS_CC);
+ zend_hash_apply_with_argument(registered_zend_ini_directives, zend_remove_ini_entries, (void *) &module_number TSRMLS_CC);
}
/* }}} */
#ifdef ZTS
-static int zend_ini_refresh_cache(zend_ini_entry *p, int stage TSRMLS_DC) /* {{{ */
+static int zend_ini_refresh_cache(zval *el, int stage TSRMLS_DC) /* {{{ */
{
+ zend_ini_entry *p = (zend_ini_entry *)Z_PTR_P(el);
if (p->on_modify) {
p->on_modify(p, p->value, p->value_length, p->mh_arg1, p->mh_arg2, p->mh_arg3, stage TSRMLS_CC);
}
@@ -240,7 +242,7 @@ static int zend_ini_refresh_cache(zend_ini_entry *p, int stage TSRMLS_DC) /* {{{
ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) /* {{{ */
{
- zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) zend_ini_refresh_cache, (void *)(zend_intptr_t) stage TSRMLS_CC);
+ zend_hash_apply_with_argument(EG(ini_directives), zend_ini_refresh_cache, (void *)(zend_intptr_t) stage TSRMLS_CC);
}
/* }}} */
#endif
diff --git a/Zend/zend_list.c b/Zend/zend_list.c
index 41565408ba..f496dd271a 100644
--- a/Zend/zend_list.c
+++ b/Zend/zend_list.c
@@ -242,7 +242,7 @@ static int zend_clean_module_rsrc_dtors_cb(zval *zv, int *module_number TSRMLS_D
{
zend_rsrc_list_dtors_entry *ld = Z_PTR_P(zv);
if (ld->module_number == *module_number) {
- zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC);
+ zend_hash_apply_with_argument(&EG(persistent_list), clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC);
return 1;
} else {
return 0;
@@ -252,7 +252,7 @@ static int zend_clean_module_rsrc_dtors_cb(zval *zv, int *module_number TSRMLS_D
void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC)
{
- zend_hash_apply_with_argument(&list_destructors, (apply_func_arg_t) zend_clean_module_rsrc_dtors_cb, (void *) &module_number TSRMLS_CC);
+ zend_hash_apply_with_argument(&list_destructors, zend_clean_module_rsrc_dtors_cb, (void *) &module_number TSRMLS_CC);
}