diff options
| author | jvoisin | 2017-10-31 17:16:36 +0100 |
|---|---|---|
| committer | jvoisin | 2017-10-31 17:16:36 +0100 |
| commit | 5903f9f85b1329efb1d0c6e427dbcff567540846 (patch) | |
| tree | 52a85deb922d6b8161c6964e4f31abeb8feacebd | |
| parent | 36acd700d812e694db91b154f7c3bc81f0f16ec8 (diff) | |
Minor factorization
| -rw-r--r-- | src/snuffleupagus.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/snuffleupagus.c b/src/snuffleupagus.c index 7db6c93..e453587 100644 --- a/src/snuffleupagus.c +++ b/src/snuffleupagus.c | |||
| @@ -52,15 +52,6 @@ ZEND_DLEXPORT zend_extension zend_extension_entry = { | |||
| 52 | NULL, /* op_array_dtor_func_t */ | 52 | NULL, /* op_array_dtor_func_t */ |
| 53 | STANDARD_ZEND_EXTENSION_PROPERTIES}; | 53 | STANDARD_ZEND_EXTENSION_PROPERTIES}; |
| 54 | 54 | ||
| 55 | /* Uncomment this function if you have INI entries | ||
| 56 | static void php_snuffleupagus_init_globals(zend_snuffleupagus_globals | ||
| 57 | *snuffleupagus_globals) | ||
| 58 | { | ||
| 59 | snuffleupagus_globals->global_value = 0; | ||
| 60 | snuffleupagus_globals->global_string = NULL; | ||
| 61 | } | ||
| 62 | */ | ||
| 63 | |||
| 64 | PHP_GINIT_FUNCTION(snuffleupagus) { | 55 | PHP_GINIT_FUNCTION(snuffleupagus) { |
| 65 | #define SP_INIT(F) F = pecalloc(sizeof(*F), 1, 1); | 56 | #define SP_INIT(F) F = pecalloc(sizeof(*F), 1, 1); |
| 66 | #define SP_INIT_HT(F) \ | 57 | #define SP_INIT_HT(F) \ |
| @@ -119,20 +110,21 @@ PHP_MSHUTDOWN_FUNCTION(snuffleupagus) { | |||
| 119 | pefree(SNUFFLEUPAGUS_G(config.config_upload_validation), 1); | 110 | pefree(SNUFFLEUPAGUS_G(config.config_upload_validation), 1); |
| 120 | pefree(SNUFFLEUPAGUS_G(config.config_cookie_encryption), 1); | 111 | pefree(SNUFFLEUPAGUS_G(config.config_cookie_encryption), 1); |
| 121 | 112 | ||
| 122 | sp_node_t* disabled_functions = SNUFFLEUPAGUS_G(config.config_disabled_functions->disabled_functions); | 113 | #define FREE_LST(L) \ |
| 123 | sp_node_t* disabled_functions_ret = SNUFFLEUPAGUS_G(config.config_disabled_functions_ret->disabled_functions); | 114 | do { \ |
| 124 | sp_node_t* disabled_constructs = SNUFFLEUPAGUS_G(config.config_disabled_constructs->construct_include); | 115 | sp_node_t* _n = SNUFFLEUPAGUS_G(L); \ |
| 116 | sp_disabled_function_list_free(_n); \ | ||
| 117 | sp_list_free(_n); \ | ||
| 118 | } while(0) | ||
| 119 | |||
| 120 | FREE_LST(config.config_disabled_functions->disabled_functions); | ||
| 121 | FREE_LST(config.config_disabled_functions_ret->disabled_functions); | ||
| 122 | FREE_LST(config.config_disabled_constructs->construct_include); | ||
| 125 | 123 | ||
| 126 | // Free the list of disabled functions for each `sp_disabled_function` instance | 124 | #undef FREE_LST |
| 127 | sp_disabled_function_list_free(disabled_functions); | ||
| 128 | sp_disabled_function_list_free(disabled_functions_ret); | ||
| 129 | sp_disabled_function_list_free(disabled_constructs); | ||
| 130 | 125 | ||
| 131 | sp_list_free(disabled_functions); | ||
| 132 | pefree(SNUFFLEUPAGUS_G(config.config_disabled_functions), 1); | 126 | pefree(SNUFFLEUPAGUS_G(config.config_disabled_functions), 1); |
| 133 | sp_list_free(disabled_functions_ret); | ||
| 134 | pefree(SNUFFLEUPAGUS_G(config.config_disabled_functions_ret), 1); | 127 | pefree(SNUFFLEUPAGUS_G(config.config_disabled_functions_ret), 1); |
| 135 | sp_list_free(disabled_constructs); | ||
| 136 | pefree(SNUFFLEUPAGUS_G(config.config_disabled_constructs), 1); | 128 | pefree(SNUFFLEUPAGUS_G(config.config_disabled_constructs), 1); |
| 137 | 129 | ||
| 138 | UNREGISTER_INI_ENTRIES(); | 130 | UNREGISTER_INI_ENTRIES(); |
