]> granicus.if.org Git - php/commitdiff
Don't use cast (compiler friendly)
authorXinchen Hui <laruence@php.net>
Mon, 26 May 2014 03:05:04 +0000 (11:05 +0800)
committerXinchen Hui <laruence@php.net>
Mon, 26 May 2014 03:05:04 +0000 (11:05 +0800)
Zend/zend_compile.c
Zend/zend_constants.c
Zend/zend_ini.c
Zend/zend_list.c
ext/standard/basic_functions.c
ext/standard/browscap.c
ext/standard/var.c
main/streams/streams.c

index 4923f634085ff8d2f0ce42168384dcfb1b06c88f..04ffa77aaf22a6cdefb59939874c11cf495506a4 100644 (file)
@@ -6831,7 +6831,7 @@ static int zend_auto_global_init(zval *zv TSRMLS_DC) /* {{{ */
 
 ZEND_API void zend_activate_auto_globals(TSRMLS_D) /* {{{ */
 {
-       zend_hash_apply(CG(auto_globals), (apply_func_t) zend_auto_global_init TSRMLS_CC);
+       zend_hash_apply(CG(auto_globals), zend_auto_global_init TSRMLS_CC);
 }
 /* }}} */
 
index a25fe2bdb5560d3883204e87d17f625e8c929af7..4f2cedb9af0d8aa9d5ac5bb756590ebe6f6aa2a6 100644 (file)
@@ -82,9 +82,12 @@ static int clean_non_persistent_constant_full(zval *zv TSRMLS_DC)
 }
 
 
-static int clean_module_constant(const zend_constant *c, int *module_number TSRMLS_DC)
+static int clean_module_constant(zval *el, void *arg TSRMLS_DC)
 {
-       if (c->module_number == *module_number) {
+       zend_constant *c = (zend_constant *)Z_PTR_P(el);
+       int module_number = *(int *)arg;
+
+       if (c->module_number == module_number) {
                return 1;
        } else {
                return 0;
@@ -94,7 +97,7 @@ static int clean_module_constant(const zend_constant *c, int *module_number TSRM
 
 void clean_module_constants(int module_number TSRMLS_DC)
 {
-       zend_hash_apply_with_argument(EG(zend_constants), (apply_func_arg_t) clean_module_constant, (void *) &module_number TSRMLS_CC);
+       zend_hash_apply_with_argument(EG(zend_constants), clean_module_constant, (void *) &module_number TSRMLS_CC);
 }
 
 
index 6f4cd4fd38dcc1c88874a3702f00c4c760e09289..6232b8e2f19cca6ae98d6f9a7b88e32d25900821 100644 (file)
@@ -34,10 +34,11 @@ static HashTable *registered_zend_ini_directives;
 /*
  * hash_apply functions
  */
-static int zend_remove_ini_entries(zval *el, int *module_number TSRMLS_DC) /* {{{ */
+static int zend_remove_ini_entries(zval *el, void *arg TSRMLS_DC) /* {{{ */
 {
        zend_ini_entry *ini_entry = (zend_ini_entry *)Z_PTR_P(el);
-       if (ini_entry->module_number == *module_number) {
+       int module_number = *(int *)arg;
+       if (ini_entry->module_number == module_number) {
                return 1;
        } else {
                return 0;
index f496dd271a39b1bd07173754d76a42676230eac2..fdd7ba86df954e67372c5c05584060768c9c903d 100644 (file)
@@ -228,9 +228,10 @@ void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC)
        zend_hash_graceful_reverse_destroy(ht);
 }
 
-static int clean_module_resource(zval *zv, int *resource_id TSRMLS_DC)
+static int clean_module_resource(zval *zv, void *arg TSRMLS_DC)
 {
-       if (Z_RES_TYPE_P(zv) == *resource_id) {
+       int resource_id = *(int *)arg;
+       if (Z_RES_TYPE_P(zv) == resource_id) {
                return 1;
        } else {
                return 0;
@@ -238,10 +239,11 @@ static int clean_module_resource(zval *zv, int *resource_id TSRMLS_DC)
 }
 
 
-static int zend_clean_module_rsrc_dtors_cb(zval *zv, int *module_number TSRMLS_DC)
+static int zend_clean_module_rsrc_dtors_cb(zval *zv, void *arg TSRMLS_DC)
 {
-       zend_rsrc_list_dtors_entry *ld = Z_PTR_P(zv);   
-       if (ld->module_number == *module_number) {
+       zend_rsrc_list_dtors_entry *ld = (zend_rsrc_list_dtors_entry *)Z_PTR_P(zv);     
+       int module_number = *(int *)arg;
+       if (ld->module_number == module_number) {
                zend_hash_apply_with_argument(&EG(persistent_list), clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC);
                return 1;
        } else {
index 8419dfe76ff034db86c644648e33e3f4adf09fc7..70c029ecca15881cb5c921fd1d876c9a576f37f7 100644 (file)
@@ -4526,7 +4526,7 @@ static int add_config_entry_cb(zval *entry TSRMLS_DC, int num_args, va_list args
                }
        } else if (Z_TYPE_P(entry) == IS_ARRAY) {
                array_init(&tmp);
-               zend_hash_apply_with_arguments(Z_ARRVAL_P(entry) TSRMLS_CC, (apply_func_args_t) add_config_entry_cb, 1, tmp);
+               zend_hash_apply_with_arguments(Z_ARRVAL_P(entry) TSRMLS_CC, add_config_entry_cb, 1, tmp);
                zend_hash_update(Z_ARRVAL_P(retval), hash_key->key, &tmp);
        }
        return 0;
@@ -4550,7 +4550,7 @@ PHP_FUNCTION(get_cfg_var)
        if (retval) {
                if (Z_TYPE_P(retval) == IS_ARRAY) {
                        array_init(return_value);
-                       zend_hash_apply_with_arguments(Z_ARRVAL_P(retval) TSRMLS_CC, (apply_func_args_t) add_config_entry_cb, 1, return_value);
+                       zend_hash_apply_with_arguments(Z_ARRVAL_P(retval) TSRMLS_CC, add_config_entry_cb, 1, return_value);
                        return;
                } else {
                        RETURN_STRING(Z_STRVAL_P(retval));
@@ -4939,7 +4939,7 @@ void php_call_shutdown_functions(TSRMLS_D) /* {{{ */
 {
        if (BG(user_shutdown_function_names)) {
                zend_try {
-                       zend_hash_apply(BG(user_shutdown_function_names), (apply_func_t) user_shutdown_function_call TSRMLS_CC);
+                       zend_hash_apply(BG(user_shutdown_function_names), user_shutdown_function_call TSRMLS_CC);
                }
                zend_end_try();
                php_free_shutdown_functions(TSRMLS_C);
@@ -5262,7 +5262,7 @@ PHP_FUNCTION(ini_get_all)
        }
 
        array_init(return_value);
-       zend_hash_apply_with_arguments(EG(ini_directives) TSRMLS_CC, (apply_func_args_t) php_ini_get_option, 2, return_value, extnumber, details);
+       zend_hash_apply_with_arguments(EG(ini_directives) TSRMLS_CC, php_ini_get_option, 2, return_value, extnumber, details);
 }
 /* }}} */
 
@@ -5902,7 +5902,7 @@ PHP_FUNCTION(config_get_hash) /* {{{ */
        HashTable *hash = php_ini_get_configuration_hash();
 
        array_init(return_value);
-       zend_hash_apply_with_arguments(hash TSRMLS_CC, (apply_func_args_t) add_config_entry_cb, 1, return_value);
+       zend_hash_apply_with_arguments(hash TSRMLS_CC, add_config_entry_cb, 1, return_value);
 }
 /* }}} */
 #endif
index fc68a34f8c9bbc719237948883357c2c94fb5e6e..f494cc86b11c940e9b6af5eed268615bfaaaac61 100644 (file)
@@ -483,7 +483,7 @@ PHP_FUNCTION(get_browser)
 
        if ((agent = zend_hash_str_find(bdata->htab, lookup_browser_name, agent_name_len)) == NULL) {
                ZVAL_UNDEF(&found_browser_entry);
-               zend_hash_apply_with_arguments(bdata->htab TSRMLS_CC, (apply_func_args_t) browser_reg_compare, 3, lookup_browser_name, agent_name_len, &found_browser_entry);
+               zend_hash_apply_with_arguments(bdata->htab TSRMLS_CC, browser_reg_compare, 3, lookup_browser_name, agent_name_len, &found_browser_entry);
 
                if (Z_TYPE(found_browser_entry) != IS_UNDEF) {
                        agent = &found_browser_entry;
index fa46cf2ee706114c33bb63c1cd8346c531e32b9b..02b738ba7bd795647df6582308536f3aa1dbaa45 100644 (file)
@@ -119,7 +119,7 @@ PHPAPI void php_var_dump(zval *struc, int level TSRMLS_DC) /* {{{ */
 {
        HashTable *myht;
        zend_string *class_name;
-       int (*php_element_dump_func)(zval* TSRMLS_DC, int, va_list, zend_hash_key*);
+       apply_func_args_t php_element_dump_func;
        int is_temp;
        int is_ref = 0;
 
@@ -178,7 +178,7 @@ again:
                        php_element_dump_func = php_object_property_dump;
        head_done:
                        if (myht) {
-                               zend_hash_apply_with_arguments(myht TSRMLS_CC, (apply_func_args_t) php_element_dump_func, 1, level);
+                               zend_hash_apply_with_arguments(myht TSRMLS_CC, php_element_dump_func, 1, level);
                                --myht->u.v.nApplyCount;
                                if (is_temp) {
                                        zend_hash_destroy(myht);
@@ -297,7 +297,7 @@ PHPAPI void php_debug_zval_dump(zval *struc, int level TSRMLS_DC) /* {{{ */
 {
        HashTable *myht = NULL;
        zend_string *class_name;
-       int (*zval_element_dump_func)(zval* TSRMLS_DC, int, va_list, zend_hash_key*);
+       apply_func_args_t zval_element_dump_func;
        int is_temp = 0;
        int is_ref = 0;
 
@@ -348,7 +348,7 @@ again:
                zval_element_dump_func = zval_object_property_dump;
 head_done:
                if (myht) {
-                       zend_hash_apply_with_arguments(myht TSRMLS_CC, (apply_func_args_t) zval_element_dump_func, 1, level, (Z_TYPE_P(struc) == IS_ARRAY ? 0 : 1));
+                       zend_hash_apply_with_arguments(myht TSRMLS_CC, zval_element_dump_func, 1, level, (Z_TYPE_P(struc) == IS_ARRAY ? 0 : 1));
                        if (is_temp) {
                                zend_hash_destroy(myht);
                                efree(myht);
@@ -537,7 +537,7 @@ again:
                                buffer_append_spaces(buf, level - 1);
                        }
                        smart_str_appendl(buf, "array (\n", 8);
-                       zend_hash_apply_with_arguments(myht TSRMLS_CC, (apply_func_args_t) php_array_element_export, 2, level, buf);
+                       zend_hash_apply_with_arguments(myht TSRMLS_CC, php_array_element_export, 2, level, buf);
 
                        if (level > 1) {
                                buffer_append_spaces(buf, level - 1);
@@ -564,7 +564,7 @@ again:
 
                        STR_RELEASE(class_name);
                        if (myht) {
-                               zend_hash_apply_with_arguments(myht TSRMLS_CC, (apply_func_args_t) php_object_element_export, 1, level, buf);
+                               zend_hash_apply_with_arguments(myht TSRMLS_CC, php_object_element_export, 1, level, buf);
                        }
                        if (level > 1) {
                                buffer_append_spaces(buf, level - 1);
index 3ed457365a8547f0c7b99cefb8566a58f8a1a385..02a313bfc6f398da0e518e43bff92c0bb654d1d0 100644 (file)
@@ -103,7 +103,7 @@ fprintf(stderr, "forget_persistent: %s:%p\n", stream->ops->label, stream);
 
 PHP_RSHUTDOWN_FUNCTION(streams)
 {
-       zend_hash_apply(&EG(persistent_list), (apply_func_t)forget_persistent_resource_id_numbers TSRMLS_CC);
+       zend_hash_apply(&EG(persistent_list), forget_persistent_resource_id_numbers TSRMLS_CC);
        return SUCCESS;
 }
 
@@ -517,7 +517,7 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov
 
                if (stream->is_persistent && (close_options & PHP_STREAM_FREE_PERSISTENT)) {
                        /* we don't work with *stream but need its value for comparison */
-                       zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) _php_stream_free_persistent, stream TSRMLS_CC);
+                       zend_hash_apply_with_argument(&EG(persistent_list), _php_stream_free_persistent, stream TSRMLS_CC);
                }
 #if ZEND_DEBUG
                if ((close_options & PHP_STREAM_FREE_RSRC_DTOR) && (stream->__exposed == 0) && (EG(error_reporting) & E_WARNING)) {