summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjvoisin2021-01-01 16:31:33 +0100
committerjvoisin2021-01-01 16:31:33 +0100
commit837fbdb88a513500520f057d27bdfedd0d3995ca (patch)
treea311472f26ac4358f5c03311ea37e99e7d4facd7 /src
parent0127dd9b9d1d81dbeb674bd956a10fbd83f42cdd (diff)
Constify a function
Diffstat (limited to 'src')
-rw-r--r--src/sp_disabled_functions.c4
-rw-r--r--src/sp_pcre_compat.c6
-rw-r--r--src/sp_pcre_compat.h1
-rw-r--r--src/sp_sloppy.c3
-rw-r--r--src/sp_utils.c3
-rw-r--r--src/sp_utils.h3
6 files changed, 12 insertions, 8 deletions
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,
40 sp_list_node* functions_list) { 40 sp_list_node* functions_list) {
41 zend_execute_data *orig_execute_data, *current; 41 zend_execute_data *orig_execute_data, *current;
42 orig_execute_data = current = execute_data; 42 orig_execute_data = current = execute_data;
43 sp_list_node const * it = functions_list; 43 sp_list_node const* it = functions_list;
44 44
45 while (current) { 45 while (current) {
46 if (it == NULL) { // every function in the list matched, we've got a match! 46 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,
60 if (0 == match) { 60 if (0 == match) {
61 it = it->next; 61 it = it->next;
62 } 62 }
63 current = current->prev_execute_data; 63 current = current->prev_execute_data;
64 } 64 }
65 65
66 EG(current_execute_data) = orig_execute_data; 66 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) {
14#else 14#else
15 const char* pcre_error = NULL; 15 const char* pcre_error = NULL;
16 int erroroffset; 16 int erroroffset;
17 ret = php_pcre_compile(pattern, PCRE_CASELESS, &pcre_error, &erroroffset, NULL); 17 ret =
18 php_pcre_compile(pattern, PCRE_CASELESS, &pcre_error, &erroroffset, NULL);
18#endif 19#endif
19 20
20 if (NULL == ret) { 21 if (NULL == ret) {
@@ -37,7 +38,8 @@ bool ZEND_HOT sp_is_regexp_matching_len(const sp_pcre* regexp, const char* str,
37 ret = pcre2_match(regexp, (PCRE2_SPTR)str, len, 0, 0, match_data, NULL); 38 ret = pcre2_match(regexp, (PCRE2_SPTR)str, len, 0, 0, match_data, NULL);
38#else 39#else
39 int vec[30]; 40 int vec[30];
40 ret = php_pcre_exec(regexp, NULL, str, len, 0, 0, vec, sizeof(vec) / sizeof(int)); 41 ret = php_pcre_exec(regexp, NULL, str, len, 0, 0, vec,
42 sizeof(vec) / sizeof(int));
41#endif 43#endif
42 44
43 if (ret < 0) { 45 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 @@
7#undef pcre_exec 7#undef pcre_exec
8#undef pcre_compile 8#undef pcre_compile
9 9
10
11#define PCRE2_CODE_UNIT_WIDTH 8 10#define PCRE2_CODE_UNIT_WIDTH 8
12#if PHP_VERSION_ID >= 70300 11#if PHP_VERSION_ID >= 70300
13#define SP_HAS_PCRE2 12#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) {
26} 26}
27 27
28#if PHP_VERSION_ID >= 80000 28#if PHP_VERSION_ID >= 80000
29ZEND_API zend_op_array* sp_compile_string(zend_string* source_string, const char* filename) { 29ZEND_API zend_op_array* sp_compile_string(zend_string* source_string,
30 const char* filename) {
30#else 31#else
31ZEND_API zend_op_array* sp_compile_string(zval* source_string, char* filename) { 32ZEND_API zend_op_array* sp_compile_string(zval* source_string, char* filename) {
32#endif 33#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,
140} 140}
141 141
142int sp_log_request(const zend_string* restrict folder, 142int sp_log_request(const zend_string* restrict folder,
143 const zend_string* restrict text_repr, char* from) { 143 const zend_string* restrict text_repr,
144 char const* const from) {
144 FILE* file; 145 FILE* file;
145 const char* current_filename = zend_get_executed_filename(TSRMLS_C); 146 const char* current_filename = zend_get_executed_filename(TSRMLS_C);
146 const int current_line = zend_get_executed_lineno(TSRMLS_C); 147 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);
76int hook_regexp(const sp_pcre *, HashTable *, zif_handler); 76int hook_regexp(const sp_pcre *, HashTable *, zif_handler);
77bool check_is_in_eval_whitelist(const zend_string *const function_name); 77bool check_is_in_eval_whitelist(const zend_string *const function_name);
78int sp_log_request(const zend_string *restrict folder, 78int sp_log_request(const zend_string *restrict folder,
79 const zend_string *restrict text_repr, char *from); 79 const zend_string *restrict text_repr,
80 char const *const from);
80bool sp_zend_string_equals(const zend_string *s1, const zend_string *s2); 81bool sp_zend_string_equals(const zend_string *s1, const zend_string *s2);
81 82
82#endif /* SP_UTILS_H */ 83#endif /* SP_UTILS_H */