diff options
| author | jvoisin | 2022-07-12 21:54:19 +0200 |
|---|---|---|
| committer | jvoisin | 2022-07-12 21:54:19 +0200 |
| commit | 8795ce1a92d226e31668db2f6cfbd33b40632109 (patch) | |
| tree | 4fa2b33f574de1ca3d6345f43f3df37df35715ce /src/sp_ini.c | |
| parent | 83014d7df165f8b8a9bf6dd4fde93fd1d42e4b7e (diff) | |
Constify some variables
Diffstat (limited to 'src/sp_ini.c')
| -rw-r--r-- | src/sp_ini.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/sp_ini.c b/src/sp_ini.c index 7fec297..ed23fb7 100644 --- a/src/sp_ini.c +++ b/src/sp_ini.c | |||
| @@ -12,12 +12,12 @@ | |||
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | static bool /* success */ sp_ini_check(zend_string *varname, zend_string *new_value, sp_ini_entry **sp_entry_p) { | 15 | static bool /* success */ sp_ini_check(zend_string *const restrict varname, zend_string const *const restrict new_value, sp_ini_entry **sp_entry_p) { |
| 16 | if (!varname || ZSTR_LEN(varname) == 0) { | 16 | if (!varname || ZSTR_LEN(varname) == 0) { |
| 17 | return false; | 17 | return false; |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | sp_config_ini *cfg = &(SPCFG(ini)); | 20 | sp_config_ini const* const cfg = &(SPCFG(ini)); |
| 21 | sp_ini_entry *entry = zend_hash_find_ptr(cfg->entries, varname); | 21 | sp_ini_entry *entry = zend_hash_find_ptr(cfg->entries, varname); |
| 22 | if (sp_entry_p) { | 22 | if (sp_entry_p) { |
| 23 | *sp_entry_p = entry; | 23 | *sp_entry_p = entry; |
| @@ -76,10 +76,9 @@ static bool /* success */ sp_ini_check(zend_string *varname, zend_string *new_va | |||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | static PHP_INI_MH(sp_ini_onmodify) { | 78 | static PHP_INI_MH(sp_ini_onmodify) { |
| 79 | zend_ini_entry *ini_entry = entry; | ||
| 80 | sp_ini_entry *sp_entry = NULL; | 79 | sp_ini_entry *sp_entry = NULL; |
| 81 | 80 | ||
| 82 | if (!sp_ini_check(ini_entry->name, new_value, &sp_entry)) { | 81 | if (!sp_ini_check(entry->name, new_value, &sp_entry)) { |
| 83 | return FAILURE; | 82 | return FAILURE; |
| 84 | } | 83 | } |
| 85 | 84 | ||
| @@ -91,7 +90,7 @@ static PHP_INI_MH(sp_ini_onmodify) { | |||
| 91 | } | 90 | } |
| 92 | 91 | ||
| 93 | void sp_hook_ini() { | 92 | void sp_hook_ini() { |
| 94 | sp_config_ini *cfg = &(SPCFG(ini)); | 93 | sp_config_ini const* const cfg = &(SPCFG(ini)); |
| 95 | sp_ini_entry *sp_entry; | 94 | sp_ini_entry *sp_entry; |
| 96 | zend_ini_entry *ini_entry; | 95 | zend_ini_entry *ini_entry; |
| 97 | ZEND_HASH_FOREACH_PTR(cfg->entries, sp_entry) | 96 | ZEND_HASH_FOREACH_PTR(cfg->entries, sp_entry) |
| @@ -126,8 +125,8 @@ void sp_hook_ini() { | |||
| 126 | 125 | ||
| 127 | void sp_unhook_ini() { | 126 | void sp_unhook_ini() { |
| 128 | sp_ini_entry *sp_entry; | 127 | sp_ini_entry *sp_entry; |
| 129 | zend_ini_entry *ini_entry; | ||
| 130 | ZEND_HASH_FOREACH_PTR(SPCFG(ini).entries, sp_entry) | 128 | ZEND_HASH_FOREACH_PTR(SPCFG(ini).entries, sp_entry) |
| 129 | zend_ini_entry *ini_entry; | ||
| 131 | if (!sp_entry->orig_onmodify) { | 130 | if (!sp_entry->orig_onmodify) { |
| 132 | // not hooked or no original onmodify | 131 | // not hooked or no original onmodify |
| 133 | continue; | 132 | continue; |
