summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sp_var_parser.c2
-rw-r--r--src/sp_var_value.c26
-rw-r--r--src/sp_wrapper.c4
3 files changed, 16 insertions, 16 deletions
diff --git a/src/sp_var_parser.c b/src/sp_var_parser.c
index b066b84..bb5a5c0 100644
--- a/src/sp_var_parser.c
+++ b/src/sp_var_parser.c
@@ -20,7 +20,7 @@ static sp_list_node *parse_str_tokens(const char *str,
20 return tokens_list; 20 return tokens_list;
21} 21}
22 22
23static bool is_var_name_valid(const char *name) { 23static bool is_var_name_valid(const char *const name) {
24 static sp_pcre *regexp_const = NULL; 24 static sp_pcre *regexp_const = NULL;
25 static sp_pcre *regexp_var = NULL; 25 static sp_pcre *regexp_var = NULL;
26 26
diff --git a/src/sp_var_value.c b/src/sp_var_value.c
index e351446..fe37f99 100644
--- a/src/sp_var_value.c
+++ b/src/sp_var_value.c
@@ -1,7 +1,7 @@
1#include "php_snuffleupagus.h" 1#include "php_snuffleupagus.h"
2 2
3static zval *get_param_var(zend_execute_data *ed, const char *var_name, 3static zval *get_param_var(const zend_execute_data *const ed,
4 bool print) { 4 const char *const var_name, bool print) {
5 unsigned int nb_param = ed->func->common.num_args; 5 unsigned int nb_param = ed->func->common.num_args;
6 6
7 for (unsigned int i = 0; i < nb_param; i++) { 7 for (unsigned int i = 0; i < nb_param; i++) {
@@ -21,7 +21,7 @@ static zval *get_param_var(zend_execute_data *ed, const char *var_name,
21 return NULL; 21 return NULL;
22} 22}
23 23
24static zval *get_local_var(zend_execute_data *ed, const char *var_name) { 24static zval *get_local_var(zend_execute_data *ed, const char *const var_name) {
25 zend_execute_data *orig_execute_data = ed; 25 zend_execute_data *orig_execute_data = ed;
26 zend_execute_data *current = ed; 26 zend_execute_data *current = ed;
27 27
@@ -52,7 +52,7 @@ static zval *get_local_var(zend_execute_data *ed, const char *var_name) {
52 return NULL; 52 return NULL;
53} 53}
54 54
55static zval *get_constant(const char *value) { 55static zval *get_constant(const char *const value) {
56 zend_string *name = zend_string_init(value, strlen(value), 0); 56 zend_string *name = zend_string_init(value, strlen(value), 0);
57 zval *zvalue = zend_get_constant_ex(name, NULL, ZEND_FETCH_CLASS_SILENT); 57 zval *zvalue = zend_get_constant_ex(name, NULL, ZEND_FETCH_CLASS_SILENT);
58 zend_string_release(name); 58 zend_string_release(name);
@@ -90,8 +90,8 @@ static zval *get_var_value(zend_execute_data *ed, const char *var_name,
90 } 90 }
91} 91}
92 92
93static void *get_entry_hashtable(const HashTable *ht, const char *entry, 93static void *get_entry_hashtable(const HashTable *const ht,
94 size_t entry_len) { 94 const char *const entry, size_t entry_len) {
95 zval *zvalue = zend_hash_str_find(ht, entry, entry_len); 95 zval *zvalue = zend_hash_str_find(ht, entry, entry_len);
96 96
97 if (!zvalue) { 97 if (!zvalue) {
@@ -109,8 +109,8 @@ static void *get_entry_hashtable(const HashTable *ht, const char *entry,
109 return zvalue; 109 return zvalue;
110} 110}
111 111
112static zval *get_array_value(zend_execute_data *ed, zval *zvalue, 112static zval *get_array_value(zend_execute_data *ed, const zval *const zvalue,
113 const sp_tree *tree) { 113 const sp_tree *const tree) {
114 zval *idx_value = sp_get_var_value(ed, tree->idx, false); 114 zval *idx_value = sp_get_var_value(ed, tree->idx, false);
115 115
116 if (!zvalue || !idx_value) { 116 if (!zvalue || !idx_value) {
@@ -118,7 +118,7 @@ static zval *get_array_value(zend_execute_data *ed, zval *zvalue,
118 } 118 }
119 119
120 if (Z_TYPE_P(zvalue) == IS_ARRAY) { 120 if (Z_TYPE_P(zvalue) == IS_ARRAY) {
121 const zend_string *idx = sp_zval_to_zend_string(idx_value); 121 const zend_string *const idx = sp_zval_to_zend_string(idx_value);
122 return get_entry_hashtable(Z_ARRVAL_P(zvalue), ZSTR_VAL(idx), 122 return get_entry_hashtable(Z_ARRVAL_P(zvalue), ZSTR_VAL(idx),
123 ZSTR_LEN(idx)); 123 ZSTR_LEN(idx));
124 } 124 }
@@ -128,10 +128,10 @@ static zval *get_array_value(zend_execute_data *ed, zval *zvalue,
128 128
129static zval *get_object_property(zend_execute_data *ed, zval *object, 129static zval *get_object_property(zend_execute_data *ed, zval *object,
130 const char *property, bool is_param) { 130 const char *property, bool is_param) {
131 char *class_name = object->value.obj->ce->name->val; 131 const char *const class_name = object->value.obj->ce->name->val;
132 HashTable *array = Z_OBJPROP_P(object); 132 HashTable *array = Z_OBJPROP_P(object);
133 zval *zvalue = NULL; 133 zval *zvalue = NULL;
134 zval *property_val = get_var_value(ed, property, is_param); 134 const zval *property_val = get_var_value(ed, property, is_param);
135 size_t len; 135 size_t len;
136 136
137 if (property_val) { 137 if (property_val) {
@@ -161,7 +161,7 @@ static zval *get_object_property(zend_execute_data *ed, zval *object,
161 return zvalue; 161 return zvalue;
162} 162}
163 163
164static zend_class_entry *get_class(const char *value) { 164static zend_class_entry *get_class(const char *const value) {
165 zend_string *name = zend_string_init(value, strlen(value), 0); 165 zend_string *name = zend_string_init(value, strlen(value), 0);
166 zend_class_entry *ce = zend_lookup_class(name); 166 zend_class_entry *ce = zend_lookup_class(name);
167 zend_string_release(name); 167 zend_string_release(name);
@@ -170,7 +170,7 @@ static zend_class_entry *get_class(const char *value) {
170 170
171static zval *get_unknown_type(const char *restrict value, zval *zvalue, 171static zval *get_unknown_type(const char *restrict value, zval *zvalue,
172 zend_class_entry *ce, zend_execute_data *ed, 172 zend_class_entry *ce, zend_execute_data *ed,
173 const sp_tree *tree, bool is_param) { 173 const sp_tree *const tree, bool is_param) {
174 if (ce) { 174 if (ce) {
175 zvalue = get_entry_hashtable(&ce->constants_table, value, strlen(value)); 175 zvalue = get_entry_hashtable(&ce->constants_table, value, strlen(value));
176 ce = NULL; 176 ce = NULL;
diff --git a/src/sp_wrapper.c b/src/sp_wrapper.c
index 277f23a..7610114 100644
--- a/src/sp_wrapper.c
+++ b/src/sp_wrapper.c
@@ -1,6 +1,6 @@
1#include "php_snuffleupagus.h" 1#include "php_snuffleupagus.h"
2 2
3static bool wrapper_is_whitelisted(const zend_string *zs) { 3static bool wrapper_is_whitelisted(const zend_string *const zs) {
4 const sp_list_node *list = SNUFFLEUPAGUS_G(config).config_wrapper->whitelist; 4 const sp_list_node *list = SNUFFLEUPAGUS_G(config).config_wrapper->whitelist;
5 5
6 if (!zs) { 6 if (!zs) {
@@ -18,7 +18,7 @@ static bool wrapper_is_whitelisted(const zend_string *zs) {
18 18
19void sp_disable_wrapper() { 19void sp_disable_wrapper() {
20 HashTable *orig = php_stream_get_url_stream_wrappers_hash(); 20 HashTable *orig = php_stream_get_url_stream_wrappers_hash();
21 HashTable *orig_complete = pemalloc(sizeof(*orig_complete), 1); 21 HashTable *orig_complete = pemalloc(sizeof(HashTable), 1);
22 zval *zv; 22 zval *zv;
23 zend_string *zs; 23 zend_string *zs;
24 24