summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-05-26 13:28:07 +0200
committerJo-Philipp Wich <jo@mein.io>2021-07-11 15:49:14 +0200
commitbf8522625f55fa2657dee3b9356b20fa0dba725f (patch)
tree82dea1608c84f4b6314f2500271258e4455ecf9d /lib
parente2b3d2ef25c5e55122c1e41ab56af1075209b47d (diff)
treewide: move ressource type registry into vm instance
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lib')
-rw-r--r--lib/fs.c8
-rw-r--r--lib/math.c2
-rw-r--r--lib/ubus.c4
-rw-r--r--lib/uci.c4
4 files changed, 9 insertions, 9 deletions
diff --git a/lib/fs.c b/lib/fs.c
index 4f96a6c..0c37aab 100644
--- a/lib/fs.c
+++ b/lib/fs.c
@@ -904,13 +904,13 @@ static void close_dir(void *ud)
closedir(dp);
}
-void uc_module_init(uc_value_t *scope)
+void uc_module_init(uc_vm *vm, uc_value_t *scope)
{
uc_add_proto_functions(scope, global_fns);
- proc_type = uc_declare_type("fs.proc", proc_fns, close_proc);
- file_type = uc_declare_type("fs.file", file_fns, close_file);
- dir_type = uc_declare_type("fs.dir", dir_fns, close_dir);
+ proc_type = uc_declare_type(vm, "fs.proc", proc_fns, close_proc);
+ file_type = uc_declare_type(vm, "fs.file", file_fns, close_file);
+ dir_type = uc_declare_type(vm, "fs.dir", dir_fns, close_dir);
ucv_object_add(scope, "stdin", uc_alloc_ressource(file_type, stdin));
ucv_object_add(scope, "stdout", uc_alloc_ressource(file_type, stdout));
diff --git a/lib/math.c b/lib/math.c
index 8f8466e..0adfaf8 100644
--- a/lib/math.c
+++ b/lib/math.c
@@ -158,7 +158,7 @@ static const uc_cfunction_list math_fns[] = {
{ "srand", uc_srand },
};
-void uc_module_init(uc_value_t *scope)
+void uc_module_init(uc_vm *vm, uc_value_t *scope)
{
uc_add_proto_functions(scope, math_fns);
}
diff --git a/lib/ubus.c b/lib/ubus.c
index 4d74710..fb7600a 100644
--- a/lib/ubus.c
+++ b/lib/ubus.c
@@ -320,9 +320,9 @@ static void close_connection(void *ud) {
free(conn);
}
-void uc_module_init(uc_value_t *scope)
+void uc_module_init(uc_vm *vm, uc_value_t *scope)
{
uc_add_proto_functions(scope, global_fns);
- conn_type = uc_declare_type("ubus.connection", conn_fns, close_connection);
+ conn_type = uc_declare_type(vm, "ubus.connection", conn_fns, close_connection);
}
diff --git a/lib/uci.c b/lib/uci.c
index 00a451c..d9a9ea6 100644
--- a/lib/uci.c
+++ b/lib/uci.c
@@ -1005,9 +1005,9 @@ static void close_uci(void *ud) {
uci_free_context((struct uci_context *)ud);
}
-void uc_module_init(uc_value_t *scope)
+void uc_module_init(uc_vm *vm, uc_value_t *scope)
{
uc_add_proto_functions(scope, global_fns);
- cursor_type = uc_declare_type("uci.cursor", cursor_fns, close_uci);
+ cursor_type = uc_declare_type(vm, "uci.cursor", cursor_fns, close_uci);
}