Skip to content

Commit

Permalink
Improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
xeioex committed Sep 26, 2024
1 parent af00685 commit 965d68f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/njs_builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
7 changes: 5 additions & 2 deletions src/njs_predefined.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion src/njs_predefined.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/njs_vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 965d68f

Please sign in to comment.