diff --git a/src/njs_builtin.c b/src/njs_builtin.c index 434fa68ac..39e361f9c 100644 --- a/src/njs_builtin.c +++ b/src/njs_builtin.c @@ -129,7 +129,7 @@ njs_builtin_objects_create(njs_vm_t *vm) njs_lvlhsh_init(&shared->keywords_hash); njs_lvlhsh_init(&shared->values_hash); - ret = njs_predefined_hash_init(&shared->predefined_hash); + ret = njs_predefined_hash_init(); if (njs_slow_path(ret != NJS_OK)) { return NJS_ERROR; } diff --git a/src/njs_predefined.c b/src/njs_predefined.c index b342bb694..5d4188ad0 100644 --- a/src/njs_predefined.c +++ b/src/njs_predefined.c @@ -595,10 +595,11 @@ static const njs_flathsh_proto_t njs_predefined_hash_proto njs_int_t -njs_predefined_hash_init(njs_flathsh_t *hash) +njs_predefined_hash_init() { u_char *start; size_t len; + uint32_t atom_id; njs_int_t ret; njs_uint_t n; njs_value_t *value; @@ -613,10 +614,12 @@ njs_predefined_hash_init(njs_flathsh_t *hash) lhq.proto = &njs_predefined_hash_proto; lhq.pool = NULL; /* Not used. */ + atom_id = NJS_SYMBOL_KNOWN_MAX; + for (n = 0; n < NJS_PREDEFINED_SIZE; n++) { value = &njs_predefined.value[n]; - value->string.atom_id = njs_predefined_atom_id++; + value->string.atom_id = atom_id++; start = value->string.data->start; len = value->string.data->length; diff --git a/src/njs_predefined.h b/src/njs_predefined.h index 4b8cdaf4e..9e0adf8d5 100644 --- a/src/njs_predefined.h +++ b/src/njs_predefined.h @@ -530,7 +530,11 @@ typedef union { } njs_predefined_values_t; -njs_int_t njs_predefined_hash_init(njs_flathsh_t *hash); +#define njs_predef(name) (njs_predefined.vs._ ## name) +#define njs_predef_empty (njs_predefined.vs._) + + +njs_int_t njs_predefined_hash_init(); extern njs_predefined_values_t njs_predefined; diff --git a/src/njs_vm.h b/src/njs_vm.h index 5f4cf48d9..6d09caf8f 100644 --- a/src/njs_vm.h +++ b/src/njs_vm.h @@ -205,7 +205,6 @@ typedef struct { struct njs_vm_shared_s { njs_lvlhsh_t keywords_hash; njs_lvlhsh_t values_hash; - njs_flathsh_t predefined_hash; njs_lvlhsh_t array_instance_hash; njs_lvlhsh_t string_instance_hash;