diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp_utils.c | 10 | ||||
| -rw-r--r-- | src/sp_utils.h | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/sp_utils.c b/src/sp_utils.c index 3436328..42f7871 100644 --- a/src/sp_utils.c +++ b/src/sp_utils.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #include "php_snuffleupagus.h" | 1 | #include "php_snuffleupagus.h" |
| 2 | 2 | ||
| 3 | static const char* default_ipaddr = "0.0.0.0"; | 3 | static char const* const default_ipaddr = "0.0.0.0"; |
| 4 | const char* get_ipaddr() { | 4 | const char* get_ipaddr() { |
| 5 | const char* client_ip = getenv("REMOTE_ADDR"); | 5 | const char* client_ip = getenv("REMOTE_ADDR"); |
| 6 | if (client_ip) { | 6 | if (client_ip) { |
| @@ -15,8 +15,8 @@ const char* get_ipaddr() { | |||
| 15 | return default_ipaddr; | 15 | return default_ipaddr; |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | void sp_log_msgf(char const* restrict feature, int level, int type, | 18 | void sp_log_msgf(char const* const restrict feature, int level, int type, |
| 19 | const char* restrict fmt, ...) { | 19 | char const* const restrict fmt, ...) { |
| 20 | char* msg; | 20 | char* msg; |
| 21 | va_list args; | 21 | va_list args; |
| 22 | 22 | ||
| @@ -63,7 +63,7 @@ void sp_log_msgf(char const* restrict feature, int level, int type, | |||
| 63 | } | 63 | } |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | int compute_hash(const char* const restrict filename, | 66 | int compute_hash(char const* const restrict filename, |
| 67 | char* restrict file_hash) { | 67 | char* restrict file_hash) { |
| 68 | unsigned char buf[1024] = {0}; | 68 | unsigned char buf[1024] = {0}; |
| 69 | unsigned char digest[SHA256_SIZE] = {0}; | 69 | unsigned char digest[SHA256_SIZE] = {0}; |
| @@ -90,7 +90,7 @@ int compute_hash(const char* const restrict filename, | |||
| 90 | return SUCCESS; | 90 | return SUCCESS; |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | int sp_log_request(const zend_string* restrict folder, const zend_string* restrict text_repr) { | 93 | int sp_log_request(zend_string const* const restrict folder, zend_string const* const restrict text_repr) { |
| 94 | FILE* file; | 94 | FILE* file; |
| 95 | char const* const current_filename = zend_get_executed_filename(TSRMLS_C); | 95 | char const* const current_filename = zend_get_executed_filename(TSRMLS_C); |
| 96 | const int current_line = zend_get_executed_lineno(TSRMLS_C); | 96 | const int current_line = zend_get_executed_lineno(TSRMLS_C); |
diff --git a/src/sp_utils.h b/src/sp_utils.h index 0e595d8..7bab4ba 100644 --- a/src/sp_utils.h +++ b/src/sp_utils.h | |||
| @@ -71,8 +71,8 @@ extern int sp_debug_stderr; | |||
| 71 | #define GET_SUFFIX(x) (x == 1) ? "st" : ((x == 2) ? "nd" : "th") | 71 | #define GET_SUFFIX(x) (x == 1) ? "st" : ((x == 2) ? "nd" : "th") |
| 72 | 72 | ||
| 73 | const char *get_ipaddr(void); | 73 | const char *get_ipaddr(void); |
| 74 | void sp_log_msgf(char const *restrict feature, int level, int type, const char *restrict fmt, ...); | 74 | void sp_log_msgf(char const* const restrict feature, int level, int type, char const* const restrict fmt, ...); |
| 75 | int compute_hash(const char *const restrict filename, char *restrict file_hash); | 75 | int compute_hash(char const* const restrict filename, char *restrict file_hash); |
| 76 | const zend_string *sp_zval_to_zend_string(const zval *); | 76 | const zend_string *sp_zval_to_zend_string(const zval *); |
| 77 | bool sp_match_value(const zend_string* value, const zend_string* to_match, const sp_regexp* rx); | 77 | bool sp_match_value(const zend_string* value, const zend_string* to_match, const sp_regexp* rx); |
| 78 | bool sp_match_array_key(const zval *, const zend_string *, const sp_regexp *); | 78 | bool sp_match_array_key(const zval *, const zend_string *, const sp_regexp *); |
| @@ -83,7 +83,7 @@ bool hook_function(const char *, HashTable *, zif_handler); | |||
| 83 | void unhook_functions(HashTable *ht); | 83 | void unhook_functions(HashTable *ht); |
| 84 | int hook_regexp(const sp_pcre *, HashTable *, zif_handler); | 84 | int hook_regexp(const sp_pcre *, HashTable *, zif_handler); |
| 85 | bool check_is_in_eval_whitelist(const char* function_name); | 85 | bool check_is_in_eval_whitelist(const char* function_name); |
| 86 | int sp_log_request(const zend_string *restrict folder, const zend_string *restrict text_repr); | 86 | int sp_log_request(zend_string const* const restrict folder, zend_string const* const restrict text_repr); |
| 87 | #define sp_zend_string_equals(s1, s2) zend_string_equals((zend_string*)s1, (zend_string*)s2) | 87 | #define sp_zend_string_equals(s1, s2) zend_string_equals((zend_string*)s1, (zend_string*)s2) |
| 88 | static inline bool sp_zend_string_equals_str(const zend_string* s1, const char *str, size_t len) { | 88 | static inline bool sp_zend_string_equals_str(const zend_string* s1, const char *str, size_t len) { |
| 89 | return (ZSTR_LEN(s1) == len && !memcmp(ZSTR_VAL(s1), str, len)); | 89 | return (ZSTR_LEN(s1) == len && !memcmp(ZSTR_VAL(s1), str, len)); |
