diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-07-05 16:09:34 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-07-11 15:49:14 +0200 |
commit | b11a2fa661058ef9788b9ff4d1e22ce98f1cbda7 (patch) | |
tree | fde48d95dfb14e6f36d54701903a8f2dc09fe403 /lib.c | |
parent | 900b2a3f05fb1ec3844cc6bde9cd2fc03d168078 (diff) |
vm: move global scope allocation into uc_vm_init()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 30 |
1 files changed, 0 insertions, 30 deletions
@@ -2950,33 +2950,3 @@ uc_load_stdlib(uc_value_t *scope) { uc_add_functions(scope, uc_stdlib_functions); } - -uc_value_t * -uc_alloc_global(uc_vm *vm) -{ - const char *path[] = { LIB_SEARCH_PATH }; - uc_value_t *global, *arr; - size_t i; - - global = ucv_object_new(vm); - - /* build default require() search path */ - arr = ucv_array_new(vm); - - for (i = 0; i < ARRAY_SIZE(path); i++) - ucv_array_push(arr, ucv_string_new(path[i])); - - /* register module related constants */ - ucv_object_add(global, "REQUIRE_SEARCH_PATH", arr); - ucv_object_add(global, "modules", ucv_object_new(vm)); - - /* register global math constants */ - ucv_object_add(global, "NaN", ucv_double_new(NAN)); - ucv_object_add(global, "Infinity", ucv_double_new(INFINITY)); - - /* register global property */ - ucv_object_add(global, "global", ucv_get(global)); - - - return global; -} |