aboutsummaryrefslogtreecommitdiff
path: root/src/njs_scope.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/njs_scope.c')
-rw-r--r--src/njs_scope.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/njs_scope.c b/src/njs_scope.c
index 304e4e33..7959849a 100644
--- a/src/njs_scope.c
+++ b/src/njs_scope.c
@@ -25,22 +25,6 @@ njs_scope_temp_index(njs_parser_scope_t *scope)
}
-njs_value_t *
-njs_scope_create_index_value(njs_vm_t *vm, njs_index_t index)
-{
- njs_value_t *value;
-
- value = njs_mp_alloc(vm->mem_pool, sizeof(njs_value_t));
- if (njs_slow_path(value == NULL)) {
- return NULL;
- }
-
- njs_scope_value_set(vm, index, value);
-
- return value;
-}
-
-
njs_value_t **
njs_scope_make(njs_vm_t *vm, uint32_t count)
{
@@ -124,7 +108,7 @@ njs_scope_values_hash_test(njs_lvlhsh_query_t *lhq, void *data)
njs_str_t string;
njs_value_t *value;
- value = data;
+ value = *(njs_value_t **) data;
if (njs_is_string(value)) {
/* parser strings are always initialized. */
@@ -172,6 +156,7 @@ njs_scope_value_index(njs_vm_t *vm, const njs_value_t *src, njs_uint_t runtime,
njs_value_t *value;
njs_string_t *string;
njs_lvlhsh_t *values_hash;
+ njs_object_prop_t *pr;
njs_lvlhsh_query_t lhq;
is_string = 0;
@@ -197,12 +182,12 @@ njs_scope_value_index(njs_vm_t *vm, const njs_value_t *src, njs_uint_t runtime,
lhq.proto = &njs_values_hash_proto;
if (njs_lvlhsh_find(&vm->shared->values_hash, &lhq) == NJS_OK) {
- value = lhq.value;
+ value = ((njs_object_prop_t *) lhq.value)->u.val;
*index = (njs_index_t *) ((u_char *) value + sizeof(njs_value_t));
} else if (runtime && njs_lvlhsh_find(&vm->values_hash, &lhq) == NJS_OK) {
- value = lhq.value;
+ value = ((njs_object_prop_t *) lhq.value)->u.val;
*index = (njs_index_t *) ((u_char *) value + sizeof(njs_value_t));
@@ -244,7 +229,6 @@ njs_scope_value_index(njs_vm_t *vm, const njs_value_t *src, njs_uint_t runtime,
**index = NJS_INDEX_ERROR;
lhq.replace = 0;
- lhq.value = value;
lhq.pool = vm->mem_pool;
values_hash = runtime ? &vm->values_hash : &vm->shared->values_hash;
@@ -253,6 +237,9 @@ njs_scope_value_index(njs_vm_t *vm, const njs_value_t *src, njs_uint_t runtime,
if (njs_slow_path(ret != NJS_OK)) {
return NULL;
}
+
+ pr = lhq.value;
+ pr->u.val = value;
}
if (start != (u_char *) src) {