summaryrefslogtreecommitdiffhomepage
path: root/ast.h
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 /ast.h
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 'ast.h')
-rw-r--r--ast.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/ast.h b/ast.h
index ecbd763..41cbc61 100644
--- a/ast.h
+++ b/ast.h
@@ -101,6 +101,7 @@ struct ut_state {
struct ut_extended_type {
const char *name;
+ struct json_object *proto;
void (*free)(void *);
};
@@ -128,8 +129,8 @@ struct json_object *ut_new_object(struct json_object *proto);
struct json_object *ut_new_double(double v);
struct json_object *ut_new_null(void);
-bool ut_register_extended_type(const char *name, void (*freefn)(void *));
-struct json_object *ut_set_extended_type(struct json_object *v, struct json_object *proto, const char *name, void *data);
+bool ut_register_extended_type(const char *name, struct json_object *proto, void (*freefn)(void *));
+struct json_object *ut_set_extended_type(struct json_object *v, const char *name, void *data);
void **ut_get_extended_type(struct json_object *val, const char *name);
void *ParseAlloc(void *(*mfunc)(size_t));