diff options
| author | jvoisin | 2018-01-15 12:09:38 +0100 |
|---|---|---|
| committer | jvoisin | 2018-01-15 12:09:38 +0100 |
| commit | e96eed3a0fda3b3bcb6290a31a80ce6705826728 (patch) | |
| tree | b782197dc283ac66e713f327acc4c85ad75367bd /src/sp_var_value.c | |
| parent | 998e3261f67900ff2729c291b8814f104fb3560d (diff) | |
Minor code cleanup
Diffstat (limited to 'src/sp_var_value.c')
| -rw-r--r-- | src/sp_var_value.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/sp_var_value.c b/src/sp_var_value.c index c56c28f..b9d8763 100644 --- a/src/sp_var_value.c +++ b/src/sp_var_value.c | |||
| @@ -20,12 +20,13 @@ static zval *get_param_var(zend_execute_data *ed, const char *var_name) { | |||
| 20 | static zval *get_local_var(zend_execute_data *ed, const char *var_name) { | 20 | static zval *get_local_var(zend_execute_data *ed, const char *var_name) { |
| 21 | zend_execute_data *orig_execute_data = ed; | 21 | zend_execute_data *orig_execute_data = ed; |
| 22 | zend_execute_data *current = ed; | 22 | zend_execute_data *current = ed; |
| 23 | zval *value = NULL; | ||
| 24 | 23 | ||
| 25 | while (current) { | 24 | while (current) { |
| 25 | zval *value = NULL; | ||
| 26 | zend_string *key = NULL; | 26 | zend_string *key = NULL; |
| 27 | EG(current_execute_data) = current; | 27 | EG(current_execute_data) = current; |
| 28 | zend_array *symtable = zend_rebuild_symbol_table(); | 28 | zend_array *symtable = zend_rebuild_symbol_table(); |
| 29 | |||
| 29 | ZEND_HASH_FOREACH_STR_KEY_VAL(symtable, key, value) { | 30 | ZEND_HASH_FOREACH_STR_KEY_VAL(symtable, key, value) { |
| 30 | if (0 == strcmp(var_name, key->val)) { | 31 | if (0 == strcmp(var_name, key->val)) { |
| 31 | if (Z_TYPE_P(value) == IS_INDIRECT) { | 32 | if (Z_TYPE_P(value) == IS_INDIRECT) { |
| @@ -52,23 +53,24 @@ static zval *get_constant(const char *value) { | |||
| 52 | 53 | ||
| 53 | static zval *get_var_value(zend_execute_data *ed, const char *var_name, | 54 | static zval *get_var_value(zend_execute_data *ed, const char *var_name, |
| 54 | bool is_param) { | 55 | bool is_param) { |
| 55 | zval *zvalue = NULL; | ||
| 56 | |||
| 57 | if (!var_name) { | 56 | if (!var_name) { |
| 58 | return NULL; | 57 | return NULL; |
| 59 | } | 58 | } |
| 59 | |||
| 60 | if (*var_name != VARIABLE_TOKEN) { | 60 | if (*var_name != VARIABLE_TOKEN) { |
| 61 | return get_constant(var_name); | 61 | return get_constant(var_name); |
| 62 | } else { | 62 | } else { |
| 63 | var_name++; | 63 | var_name++; |
| 64 | } | 64 | } |
| 65 | |||
| 65 | if (is_param) { | 66 | if (is_param) { |
| 66 | zvalue = get_param_var(ed, var_name); | 67 | zval *zvalue = get_param_var(ed, var_name); |
| 67 | if (!zvalue) { | 68 | if (!zvalue) { |
| 68 | return get_local_var(ed, var_name); | 69 | return get_local_var(ed, var_name); |
| 69 | } | 70 | } |
| 70 | return zvalue; | 71 | return zvalue; |
| 71 | } | 72 | } |
| 73 | |||
| 72 | return get_local_var(ed, var_name); | 74 | return get_local_var(ed, var_name); |
| 73 | } | 75 | } |
| 74 | 76 | ||
| @@ -79,6 +81,7 @@ static void *get_entry_hashtable(const HashTable *ht, const char *entry, | |||
| 79 | if (!zvalue) { | 81 | if (!zvalue) { |
| 80 | zvalue = zend_hash_index_find(ht, atol(entry)); | 82 | zvalue = zend_hash_index_find(ht, atol(entry)); |
| 81 | } | 83 | } |
| 84 | |||
| 82 | while (zvalue && | 85 | while (zvalue && |
| 83 | (Z_TYPE_P(zvalue) == IS_INDIRECT || Z_TYPE_P(zvalue) == IS_PTR)) { | 86 | (Z_TYPE_P(zvalue) == IS_INDIRECT || Z_TYPE_P(zvalue) == IS_PTR)) { |
| 84 | if (Z_TYPE_P(zvalue) == IS_INDIRECT) { | 87 | if (Z_TYPE_P(zvalue) == IS_INDIRECT) { |
| @@ -141,11 +144,8 @@ static zval *get_object_property(zend_execute_data *ed, zval *object, | |||
| 141 | } | 144 | } |
| 142 | 145 | ||
| 143 | static zend_class_entry *get_class(const char *value) { | 146 | static zend_class_entry *get_class(const char *value) { |
| 144 | zend_string *name; | 147 | zend_string *name = zend_string_init(value, strlen(value), 0); |
| 145 | zend_class_entry *ce; | 148 | zend_class_entry *ce = zend_lookup_class(name); |
| 146 | |||
| 147 | name = zend_string_init(value, strlen(value), 0); | ||
| 148 | ce = zend_lookup_class(name); | ||
| 149 | zend_string_release(name); | 149 | zend_string_release(name); |
| 150 | return ce; | 150 | return ce; |
| 151 | } | 151 | } |
