diff options
| author | jvoisin | 2021-07-22 17:46:01 +0200 |
|---|---|---|
| committer | jvoisin | 2021-07-22 17:46:01 +0200 |
| commit | a27aa204d6b1e556dc30b0426f96d2c9244e75f8 (patch) | |
| tree | 7e2b0723fe769fb1eb7bbfe45d7e1adbab00bf45 /src/sp_var_value.c | |
| parent | 8353de00398b13f6c94eeab6e2401d2e590543c6 (diff) | |
Sprinkle some const
Diffstat (limited to 'src/sp_var_value.c')
| -rw-r--r-- | src/sp_var_value.c | 26 |
1 files changed, 13 insertions, 13 deletions
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 | ||
| 3 | static zval *get_param_var(zend_execute_data *ed, const char *var_name, | 3 | static 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 | ||
| 24 | static zval *get_local_var(zend_execute_data *ed, const char *var_name) { | 24 | static 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 | ||
| 55 | static zval *get_constant(const char *value) { | 55 | static 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 | ||
| 93 | static void *get_entry_hashtable(const HashTable *ht, const char *entry, | 93 | static 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 | ||
| 112 | static zval *get_array_value(zend_execute_data *ed, zval *zvalue, | 112 | static 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 | ||
| 129 | static zval *get_object_property(zend_execute_data *ed, zval *object, | 129 | static 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 | ||
| 164 | static zend_class_entry *get_class(const char *value) { | 164 | static 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 | ||
| 171 | static zval *get_unknown_type(const char *restrict value, zval *zvalue, | 171 | static 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; |
