From 837fbdb88a513500520f057d27bdfedd0d3995ca Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 1 Jan 2021 16:31:33 +0100 Subject: Constify a function --- src/sp_disabled_functions.c | 4 ++-- src/sp_pcre_compat.c | 6 ++++-- src/sp_pcre_compat.h | 1 - src/sp_sloppy.c | 3 ++- src/sp_utils.c | 3 ++- src/sp_utils.h | 3 ++- 6 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c index c5ea437..41c9f23 100644 --- a/src/sp_disabled_functions.c +++ b/src/sp_disabled_functions.c @@ -40,7 +40,7 @@ static bool is_functions_list_matching(zend_execute_data* execute_data, sp_list_node* functions_list) { zend_execute_data *orig_execute_data, *current; orig_execute_data = current = execute_data; - sp_list_node const * it = functions_list; + sp_list_node const* it = functions_list; while (current) { if (it == NULL) { // every function in the list matched, we've got a match! @@ -60,7 +60,7 @@ static bool is_functions_list_matching(zend_execute_data* execute_data, if (0 == match) { it = it->next; } - current = current->prev_execute_data; + current = current->prev_execute_data; } EG(current_execute_data) = orig_execute_data; diff --git a/src/sp_pcre_compat.c b/src/sp_pcre_compat.c index d2efc71..b4d29f0 100644 --- a/src/sp_pcre_compat.c +++ b/src/sp_pcre_compat.c @@ -14,7 +14,8 @@ sp_pcre* sp_pcre_compile(const char* const pattern) { #else const char* pcre_error = NULL; int erroroffset; - ret = php_pcre_compile(pattern, PCRE_CASELESS, &pcre_error, &erroroffset, NULL); + ret = + php_pcre_compile(pattern, PCRE_CASELESS, &pcre_error, &erroroffset, NULL); #endif if (NULL == ret) { @@ -37,7 +38,8 @@ bool ZEND_HOT sp_is_regexp_matching_len(const sp_pcre* regexp, const char* str, ret = pcre2_match(regexp, (PCRE2_SPTR)str, len, 0, 0, match_data, NULL); #else int vec[30]; - ret = php_pcre_exec(regexp, NULL, str, len, 0, 0, vec, sizeof(vec) / sizeof(int)); + ret = php_pcre_exec(regexp, NULL, str, len, 0, 0, vec, + sizeof(vec) / sizeof(int)); #endif if (ret < 0) { diff --git a/src/sp_pcre_compat.h b/src/sp_pcre_compat.h index b70630d..11f7f7c 100644 --- a/src/sp_pcre_compat.h +++ b/src/sp_pcre_compat.h @@ -7,7 +7,6 @@ #undef pcre_exec #undef pcre_compile - #define PCRE2_CODE_UNIT_WIDTH 8 #if PHP_VERSION_ID >= 70300 #define SP_HAS_PCRE2 diff --git a/src/sp_sloppy.c b/src/sp_sloppy.c index d9c9e8d..f9ed718 100644 --- a/src/sp_sloppy.c +++ b/src/sp_sloppy.c @@ -26,7 +26,8 @@ static void modify_opcode(zend_op_array* opline) { } #if PHP_VERSION_ID >= 80000 -ZEND_API zend_op_array* sp_compile_string(zend_string* source_string, const char* filename) { +ZEND_API zend_op_array* sp_compile_string(zend_string* source_string, + const char* filename) { #else ZEND_API zend_op_array* sp_compile_string(zval* source_string, char* filename) { #endif diff --git a/src/sp_utils.c b/src/sp_utils.c index cb63037..04074bf 100644 --- a/src/sp_utils.c +++ b/src/sp_utils.c @@ -140,7 +140,8 @@ static int construct_filename(char* filename, } int sp_log_request(const zend_string* restrict folder, - const zend_string* restrict text_repr, char* from) { + const zend_string* restrict text_repr, + char const* const from) { FILE* file; const char* current_filename = zend_get_executed_filename(TSRMLS_C); const int current_line = zend_get_executed_lineno(TSRMLS_C); diff --git a/src/sp_utils.h b/src/sp_utils.h index 24c74bf..a883d6d 100644 --- a/src/sp_utils.h +++ b/src/sp_utils.h @@ -76,7 +76,8 @@ int hook_function(const char *, HashTable *, zif_handler); int hook_regexp(const sp_pcre *, HashTable *, zif_handler); bool check_is_in_eval_whitelist(const zend_string *const function_name); int sp_log_request(const zend_string *restrict folder, - const zend_string *restrict text_repr, char *from); + const zend_string *restrict text_repr, + char const *const from); bool sp_zend_string_equals(const zend_string *s1, const zend_string *s2); #endif /* SP_UTILS_H */ -- cgit v1.3