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_var_value.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/sp_var_value.c') diff --git a/src/sp_var_value.c b/src/sp_var_value.c index 7ed8dfa..e91c3d8 100644 --- a/src/sp_var_value.c +++ b/src/sp_var_value.c @@ -107,10 +107,9 @@ static zval *get_array_value(zend_execute_data *ed, zval *zvalue, } if (Z_TYPE_P(zvalue) == IS_ARRAY) { - char *idx = sp_convert_to_string(idx_value); - zval *ret = get_entry_hashtable(Z_ARRVAL_P(zvalue), idx, strlen(idx)); - efree(idx); - return ret; + const zend_string *idx = sp_zval_to_zend_string(idx_value); + return get_entry_hashtable(Z_ARRVAL_P(zvalue), ZSTR_VAL(idx), + ZSTR_LEN(idx)); } return NULL; -- cgit v1.3