From b19b50dd519c5731ea95aae4515c07353aa087c3 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 16 Jul 2018 11:24:22 +0200 Subject: Yet an other clang-format pass --- src/php_snuffleupagus.h | 1 - src/snuffleupagus.c | 46 ++++++++++++++++++++++++++++------------------ 2 files changed, 28 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/php_snuffleupagus.h b/src/php_snuffleupagus.h index 008a480..b35b730 100644 --- a/src/php_snuffleupagus.h +++ b/src/php_snuffleupagus.h @@ -45,7 +45,6 @@ #include "sp_session.h" #include "sp_sloppy.h" - extern zend_module_entry snuffleupagus_module_entry; #define phpext_snuffleupagus_ptr &snuffleupagus_module_entry diff --git a/src/snuffleupagus.c b/src/snuffleupagus.c index ad1d0a9..3f9e1eb 100644 --- a/src/snuffleupagus.c +++ b/src/snuffleupagus.c @@ -40,10 +40,8 @@ PHP_INI_ENTRY("sp.configuration_file", "", PHP_INI_SYSTEM, PHP_INI_END() void free_disabled_functions_hashtable(HashTable *ht) { - void* ptr = NULL; - ZEND_HASH_FOREACH_PTR(ht, ptr) { - sp_list_free(ptr); - } + void *ptr = NULL; + ZEND_HASH_FOREACH_PTR(ht, ptr) { sp_list_free(ptr); } ZEND_HASH_FOREACH_END(); } @@ -80,7 +78,8 @@ PHP_GINIT_FUNCTION(snuffleupagus) { SP_INIT_HT(snuffleupagus_globals->config.config_disabled_functions); SP_INIT_HT(snuffleupagus_globals->config.config_disabled_functions_hooked); SP_INIT_HT(snuffleupagus_globals->config.config_disabled_functions_ret); - SP_INIT_HT(snuffleupagus_globals->config.config_disabled_functions_ret_hooked); + SP_INIT_HT( + snuffleupagus_globals->config.config_disabled_functions_ret_hooked); SP_INIT(snuffleupagus_globals->config.config_unserialize); SP_INIT(snuffleupagus_globals->config.config_random); @@ -116,10 +115,14 @@ PHP_MINIT_FUNCTION(snuffleupagus) { } PHP_MSHUTDOWN_FUNCTION(snuffleupagus) { - free_disabled_functions_hashtable(SNUFFLEUPAGUS_G(config).config_disabled_functions); - free_disabled_functions_hashtable(SNUFFLEUPAGUS_G(config).config_disabled_functions_hooked); - free_disabled_functions_hashtable(SNUFFLEUPAGUS_G(config).config_disabled_functions_ret); - free_disabled_functions_hashtable(SNUFFLEUPAGUS_G(config).config_disabled_functions_ret_hooked); + free_disabled_functions_hashtable( + SNUFFLEUPAGUS_G(config).config_disabled_functions); + free_disabled_functions_hashtable( + SNUFFLEUPAGUS_G(config).config_disabled_functions_hooked); + free_disabled_functions_hashtable( + SNUFFLEUPAGUS_G(config).config_disabled_functions_ret); + free_disabled_functions_hashtable( + SNUFFLEUPAGUS_G(config).config_disabled_functions_ret_hooked); #define FREE_HT(F) \ zend_hash_destroy(SNUFFLEUPAGUS_G(F)); \ @@ -152,7 +155,8 @@ PHP_MSHUTDOWN_FUNCTION(snuffleupagus) { } while (0) FREE_LST_DISABLE(config.config_disabled_functions_reg->disabled_functions); - FREE_LST_DISABLE(config.config_disabled_functions_reg_ret->disabled_functions); + FREE_LST_DISABLE( + config.config_disabled_functions_reg_ret->disabled_functions); sp_list_free(SNUFFLEUPAGUS_G(config).config_cookie->cookies); sp_list_free(SNUFFLEUPAGUS_G(config).config_eval->blacklist); sp_list_free(SNUFFLEUPAGUS_G(config).config_eval->whitelist); @@ -261,19 +265,25 @@ static PHP_INI_MH(OnUpdateConfiguration) { // This is needed to implement the global strict mode CG(compiler_options) |= ZEND_COMPILE_HANDLE_OP_ARRAY; } - if (zend_hash_str_find(SNUFFLEUPAGUS_G(config).config_disabled_functions_hooked, - "echo", strlen("echo")) || - zend_hash_str_find(SNUFFLEUPAGUS_G(config).config_disabled_functions_ret_hooked, - "echo", strlen("echo"))) { + if (zend_hash_str_find( + SNUFFLEUPAGUS_G(config).config_disabled_functions_hooked, "echo", + strlen("echo")) || + zend_hash_str_find( + SNUFFLEUPAGUS_G(config).config_disabled_functions_ret_hooked, "echo", + strlen("echo"))) { zend_write_default = zend_write; zend_write = hook_echo; } SNUFFLEUPAGUS_G(config).hook_execute = - SNUFFLEUPAGUS_G(config).config_disabled_functions_reg->disabled_functions || - SNUFFLEUPAGUS_G(config).config_disabled_functions_reg_ret->disabled_functions || - zend_hash_num_elements(SNUFFLEUPAGUS_G(config).config_disabled_functions) || - zend_hash_num_elements(SNUFFLEUPAGUS_G(config).config_disabled_functions_ret); + SNUFFLEUPAGUS_G(config) + .config_disabled_functions_reg->disabled_functions || + SNUFFLEUPAGUS_G(config) + .config_disabled_functions_reg_ret->disabled_functions || + zend_hash_num_elements( + SNUFFLEUPAGUS_G(config).config_disabled_functions) || + zend_hash_num_elements( + SNUFFLEUPAGUS_G(config).config_disabled_functions_ret); return SUCCESS; } -- cgit v1.3