summaryrefslogtreecommitdiffhomepage
path: root/lib/ubus.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-09-20 22:20:54 +0200
committerJo-Philipp Wich <jo@mein.io>2020-09-20 22:20:54 +0200
commit2c6ce788d039ac5aed91955b0be5640bf1318ef5 (patch)
tree6e78dbb9113d67b3a210a5d1c9630229d4c8ab58 /lib/ubus.c
parent37daee3aaad91536fc57e01e50f44319ee494ee3 (diff)
treewide: rework extended type handling
Register prototype object directly together with the type instead of setting it manually whenever an extended type value is instantiated. This also allows freeing the various prototype objects in dlopened modules. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lib/ubus.c')
-rw-r--r--lib/ubus.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/ubus.c b/lib/ubus.c
index 55793a2..21f7a7b 100644
--- a/lib/ubus.c
+++ b/lib/ubus.c
@@ -25,8 +25,6 @@
static const struct ut_ops *ops;
-static struct json_object *conn_proto;
-
static enum ubus_msg_status last_error = 0;
struct ubus_connection {
@@ -171,7 +169,7 @@ ut_ubus_connect(struct ut_state *s, uint32_t off, struct json_object *args)
ubus_add_uloop(c->ctx);
- return ops->set_type(co, conn_proto, "ubus.connection", c);
+ return ops->set_type(co, "ubus.connection", c);
}
static void
@@ -317,11 +315,13 @@ static void close_connection(void *ud) {
void ut_module_init(const struct ut_ops *ut, struct ut_state *s, struct json_object *scope)
{
- ops = ut;
- ops->register_type("ubus.connection", close_connection);
+ struct json_object *conn_proto;
+ ops = ut;
conn_proto = ops->new_object(NULL);
register_functions(ops, global_fns, scope);
register_functions(ops, conn_fns, conn_proto);
+
+ ops->register_type("ubus.connection", conn_proto, close_connection);
}