diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-12-19 02:49:56 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-12-19 02:49:56 +0300 |
commit | cec091176cecd3f1efd553f4283fa7346184ad36 (patch) | |
tree | 965bd52566d4f58045f8cb7f4ec32097799ef676 /sapi | |
parent | f67f42122adb83b6df75ad9f7a64281a73e845f6 (diff) | |
download | php-git-cec091176cecd3f1efd553f4283fa7346184ad36.tar.gz |
Replace zend_hash_apply... with ZEND_HASH_FOREACH...
Diffstat (limited to 'sapi')
-rw-r--r-- | sapi/cgi/cgi_main.c | 12 | ||||
-rw-r--r-- | sapi/cli/php_cli.c | 13 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_main.c | 13 |
3 files changed, 12 insertions, 26 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index a30fa84d91..29f8c1a9b8 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -244,13 +244,6 @@ static void fcgi_log(int type, const char *format, ...) { } #endif -static int print_module_info(zval *element) -{ - zend_module_entry *module = Z_PTR_P(element); - php_printf("%s\n", module->name); - return ZEND_HASH_APPLY_KEEP; -} - static int module_name_cmp(const void *a, const void *b) { Bucket *f = (Bucket *) a; @@ -263,11 +256,14 @@ static int module_name_cmp(const void *a, const void *b) static void print_modules(void) { HashTable sorted_registry; + zend_module_entry *module; zend_hash_init(&sorted_registry, 64, NULL, NULL, 1); zend_hash_copy(&sorted_registry, &module_registry, NULL); zend_hash_sort(&sorted_registry, module_name_cmp, 0); - zend_hash_apply(&sorted_registry, print_module_info); + ZEND_HASH_FOREACH_PTR(&sorted_registry, module) { + php_printf("%s\n", module->name); + } ZEND_HASH_FOREACH_END(); zend_hash_destroy(&sorted_registry); } diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 3b053e223a..be0f11e431 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -182,14 +182,6 @@ const opt_struct OPTIONS[] = { {'-', 0, NULL} /* end of args */ }; -static int print_module_info(zval *element) /* {{{ */ -{ - zend_module_entry *module = (zend_module_entry*)Z_PTR_P(element); - php_printf("%s\n", module->name); - return ZEND_HASH_APPLY_KEEP; -} -/* }}} */ - static int module_name_cmp(const void *a, const void *b) /* {{{ */ { Bucket *f = (Bucket *) a; @@ -203,11 +195,14 @@ static int module_name_cmp(const void *a, const void *b) /* {{{ */ static void print_modules(void) /* {{{ */ { HashTable sorted_registry; + zend_module_entry *module; zend_hash_init(&sorted_registry, 50, NULL, NULL, 0); zend_hash_copy(&sorted_registry, &module_registry, NULL); zend_hash_sort(&sorted_registry, module_name_cmp, 0); - zend_hash_apply(&sorted_registry, print_module_info); + ZEND_HASH_FOREACH_PTR(&sorted_registry, module) { + php_printf("%s\n", module->name); + } ZEND_HASH_FOREACH_END(); zend_hash_destroy(&sorted_registry); } /* }}} */ diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index b8b338dd51..e149eeb2ed 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -188,14 +188,6 @@ static php_cgi_globals_struct php_cgi_globals; #define CGIG(v) (php_cgi_globals.v) #endif -static int print_module_info(zval *zv) /* {{{ */ -{ - zend_module_entry *module = Z_PTR_P(zv); - php_printf("%s\n", module->name); - return 0; -} -/* }}} */ - static int module_name_cmp(const void *a, const void *b) /* {{{ */ { Bucket *f = (Bucket *) a; @@ -209,11 +201,14 @@ static int module_name_cmp(const void *a, const void *b) /* {{{ */ static void print_modules(void) /* {{{ */ { HashTable sorted_registry; + zend_module_entry *module; zend_hash_init(&sorted_registry, 50, NULL, NULL, 1); zend_hash_copy(&sorted_registry, &module_registry, NULL); zend_hash_sort(&sorted_registry, module_name_cmp, 0); - zend_hash_apply(&sorted_registry, print_module_info); + ZEND_HASH_FOREACH_PTR(&sorted_registry, module) { + php_printf("%s\n", module->name); + } ZEND_HASH_FOREACH_END(); zend_hash_destroy(&sorted_registry); } /* }}} */ |