Skip to content

Commit

Permalink
Added predefined strings hash.
Browse files Browse the repository at this point in the history
Introduced vm->shared->cnst_hash, populated by
njs_value_t for all predefined strings.
  • Loading branch information
VadimZhestikov committed Sep 25, 2024
1 parent d40d238 commit c70d1b3
Show file tree
Hide file tree
Showing 7 changed files with 1,208 additions and 2 deletions.
1 change: 1 addition & 0 deletions auto/sources
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ NJS_LIB_SRCS=" \
src/njs_utils.c \
src/njs_chb.c \
src/njs_value.c \
src/njs_predefined.c \
src/njs_vm.c \
src/njs_vmcode.c \
src/njs_lexer.c \
Expand Down
5 changes: 5 additions & 0 deletions src/njs_builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ 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);
if (njs_slow_path(ret != NJS_OK)) {
return NJS_ERROR;
}

pattern = njs_regexp_pattern_create(vm, (u_char *) "(?:)",
njs_length("(?:)"), 0);
if (njs_slow_path(pattern == NULL)) {
Expand Down
1 change: 1 addition & 0 deletions src/njs_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

#include <njs.h>
#include <njs_value.h>
#include <njs_predefined.h>

#include <njs_vm.h>
#include <njs_object_prop_declare.h>
Expand Down
Loading

0 comments on commit c70d1b3

Please sign in to comment.