summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2018-02-06 14:51:15 +0100
committerjvoisin2018-02-06 14:51:15 +0100
commit24276c548e5ac03e167a2ded7f8927ae5466d449 (patch)
tree61070be9b25f80c31d772c31b3200b11c63db7d4
parent37e9db2ec911c2f093ee8a69b245c09d43ab0823 (diff)
Make our API consistent
-rw-r--r--src/sp_config_keywords.c6
-rw-r--r--src/sp_disabled_functions.c4
-rw-r--r--src/sp_var_parser.c4
-rw-r--r--src/sp_var_parser.h4
-rw-r--r--src/sp_var_value.c4
5 files changed, 11 insertions, 11 deletions
diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c
index 959fa38..d110749 100644
--- a/src/sp_config_keywords.c
+++ b/src/sp_config_keywords.c
@@ -344,10 +344,10 @@ int parse_disabled_functions(char *line) {
344 char *new = pecalloc(strlen(param) + 2, 1, 1); 344 char *new = pecalloc(strlen(param) + 2, 1, 1);
345 new[0] = '$'; 345 new[0] = '$';
346 memcpy(new + 1, param, strlen(param)); 346 memcpy(new + 1, param, strlen(param));
347 df->param = parse_var(new); 347 df->param = sp_parse_var(new);
348 free(new); 348 free(new);
349 } else { 349 } else {
350 df->param = parse_var(param); 350 df->param = sp_parse_var(param);
351 } 351 }
352 if (!df->param) { 352 if (!df->param) {
353 sp_log_err("config", "Invalid value '%s' for `param` on line %zu.", param, 353 sp_log_err("config", "Invalid value '%s' for `param` on line %zu.", param,
@@ -358,7 +358,7 @@ int parse_disabled_functions(char *line) {
358 358
359 if (var) { 359 if (var) {
360 if (*var) { 360 if (*var) {
361 df->var = parse_var(var); 361 df->var = sp_parse_var(var);
362 if (!df->var) { 362 if (!df->var) {
363 sp_log_err("config", "Invalid value '%s' for `var` on line %zu.", var, 363 sp_log_err("config", "Invalid value '%s' for `var` on line %zu.", var,
364 sp_line_no); 364 sp_line_no);
diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c
index eb0ba83..779240e 100644
--- a/src/sp_disabled_functions.c
+++ b/src/sp_disabled_functions.c
@@ -67,7 +67,7 @@ static bool is_local_var_matching(
67 const sp_disabled_function* const config_node) { 67 const sp_disabled_function* const config_node) {
68 zval* var_value; 68 zval* var_value;
69 69
70 var_value = get_value(execute_data, config_node->var, false); 70 var_value = sp_get_var_value(execute_data, config_node->var, false);
71 if (var_value) { 71 if (var_value) {
72 if (Z_TYPE_P(var_value) == IS_ARRAY) { 72 if (Z_TYPE_P(var_value) == IS_ARRAY) {
73 if (config_node->key || config_node->r_key) { 73 if (config_node->key || config_node->r_key) {
@@ -187,7 +187,7 @@ static bool is_param_matching(zend_execute_data* execute_data,
187 } 187 }
188 } else if (config_node->param) { 188 } else if (config_node->param) {
189 *arg_name = config_node->param->value; 189 *arg_name = config_node->param->value;
190 arg_value = get_value(execute_data, config_node->param, true); 190 arg_value = sp_get_var_value(execute_data, config_node->param, true);
191 191
192 if (arg_value) { 192 if (arg_value) {
193 *arg_value_str = sp_convert_to_string(arg_value); 193 *arg_value_str = sp_convert_to_string(arg_value);
diff --git a/src/sp_var_parser.c b/src/sp_var_parser.c
index ab36677..8e5bdb1 100644
--- a/src/sp_var_parser.c
+++ b/src/sp_var_parser.c
@@ -74,7 +74,7 @@ static int create_var(sp_tree *tree, const char *restrict value,
74 sp_log_err("config", "Invalid var name: %s.", var_node->value); 74 sp_log_err("config", "Invalid var name: %s.", var_node->value);
75 return -1; 75 return -1;
76 } 76 }
77 var_node->idx = parse_var(idx); 77 var_node->idx = sp_parse_var(idx);
78 78
79 if (tree != var_node) { 79 if (tree != var_node) {
80 while (tree->next) { 80 while (tree->next) {
@@ -222,7 +222,7 @@ static sp_tree *parse_tokens(const char *restrict str,
222 return tree; 222 return tree;
223} 223}
224 224
225sp_tree *parse_var(const char *line) { 225sp_tree *sp_parse_var(const char *line) {
226 sp_list_node *tokens_list = NULL; 226 sp_list_node *tokens_list = NULL;
227 sp_tree *tree = NULL; 227 sp_tree *tree = NULL;
228 const sp_conf_token delimiter_list[] = { 228 const sp_conf_token delimiter_list[] = {
diff --git a/src/sp_var_parser.h b/src/sp_var_parser.h
index 4a26e58..6d53691 100644
--- a/src/sp_var_parser.h
+++ b/src/sp_var_parser.h
@@ -8,8 +8,8 @@ typedef struct sp_token_s {
8 size_t pos; 8 size_t pos;
9} sp_conf_token; 9} sp_conf_token;
10 10
11zval *get_value(zend_execute_data *, const sp_tree *, bool); 11zval *sp_get_var_value(zend_execute_data *, const sp_tree *, bool);
12sp_tree *parse_var(const char *); 12sp_tree *sp_parse_var(const char *);
13 13
14#define OBJECT_TOKEN "->" 14#define OBJECT_TOKEN "->"
15#define ARRAY_TOKEN "[" 15#define ARRAY_TOKEN "["
diff --git a/src/sp_var_value.c b/src/sp_var_value.c
index 05598bf..68fd47c 100644
--- a/src/sp_var_value.c
+++ b/src/sp_var_value.c
@@ -100,7 +100,7 @@ static void *get_entry_hashtable(const HashTable *ht, const char *entry,
100 100
101static zval *get_array_value(zend_execute_data *ed, zval *zvalue, 101static zval *get_array_value(zend_execute_data *ed, zval *zvalue,
102 const sp_tree *tree) { 102 const sp_tree *tree) {
103 zval *idx_value = get_value(ed, tree->idx, false); 103 zval *idx_value = sp_get_var_value(ed, tree->idx, false);
104 104
105 if (!zvalue || !idx_value) { 105 if (!zvalue || !idx_value) {
106 return NULL; 106 return NULL;
@@ -177,7 +177,7 @@ static zval *get_unknown_type(const char *restrict value, zval *zvalue,
177 return zvalue; 177 return zvalue;
178} 178}
179 179
180zval *get_value(zend_execute_data *ed, const sp_tree *tree, bool is_param) { 180zval *sp_get_var_value(zend_execute_data *ed, const sp_tree *tree, bool is_param) {
181 zval *zvalue = NULL; 181 zval *zvalue = NULL;
182 zend_class_entry *ce = NULL; 182 zend_class_entry *ce = NULL;
183 183