From 7963580d72a358975133f86f01de2d2eab08ba38 Mon Sep 17 00:00:00 2001 From: xXx-caillou-xXx Date: Fri, 13 Jul 2018 10:36:50 +0200 Subject: Massively optimize how rules are handled This commit does a lot of things: - Use hashtables instead of lists to store the rules - Rules that can be applied at launch time won't be tried at runtime - Improve feedback when writing nonsensical rules - Make intensive use of `zend_string` instead of `char*`--- src/sp_utils.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/sp_utils.h') diff --git a/src/sp_utils.h b/src/sp_utils.h index 61a23f9..a21a4b0 100644 --- a/src/sp_utils.h +++ b/src/sp_utils.h @@ -44,20 +44,20 @@ void sp_log_msg(char const *feature, char const *level, const char *fmt, ...); int compute_hash(const char *const filename, char *file_hash); -char *sp_convert_to_string(zval *); -bool sp_match_value(const char *, const char *, const sp_pcre *); -bool sp_match_array_key(const zval *, const char *, const sp_pcre *); -bool sp_match_array_value(const zval *, const char *, const sp_pcre *); +const zend_string* sp_zval_to_zend_string(zval *); +bool sp_match_value(const zend_string *, const zend_string *, const sp_pcre *); +bool sp_match_array_key(const zval *, const zend_string *, const sp_pcre *); +bool sp_match_array_value(const zval *, const zend_string *, const sp_pcre *); void sp_log_disable(const char *restrict, const char *restrict, - const char *restrict, const sp_disabled_function *, + const zend_string *restrict, const sp_disabled_function *, unsigned int, const char*restrict); -void sp_log_disable_ret(const char *restrict, const char *restrict, +void sp_log_disable_ret(const char *restrict, const zend_string *restrict, const sp_disabled_function *); int hook_function(const char *, HashTable *, void (*)(INTERNAL_FUNCTION_PARAMETERS)); int hook_regexp(const sp_pcre *, HashTable *, void (*)(INTERNAL_FUNCTION_PARAMETERS)); -bool check_is_in_eval_whitelist(const char * const function_name); -int sp_log_request(const char* folder, const char* text_repr, char* from); +bool check_is_in_eval_whitelist(const zend_string * const function_name); +int sp_log_request(const zend_string* folder, const zend_string* text_repr, char* from); #endif /* SP_UTILS_H */ -- cgit v1.3