diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-09-10 16:34:12 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-09-10 16:35:13 +0200 |
commit | 39164c57d893b02f9a253c661abc2459bcd57e5c (patch) | |
tree | 7df7bb35122bc692818feb883726e5910b892101 /module.h | |
parent | d33d86fae9b72b352a335488e2e1401e3b0c66a1 (diff) |
treewide: eliminate unused function arguments
Also introduce convenience macro for registering function arrays in modules.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'module.h')
-rw-r--r-- | module.h | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -21,15 +21,20 @@ #include "lib.h" struct ut_ops { - bool (*register_function)(struct ut_state *, struct json_object *, const char *, ut_c_fn *); + bool (*register_function)(struct json_object *, const char *, ut_c_fn *); bool (*register_type)(const char *, void (*)(void *)); - struct json_object *(*set_type)(struct ut_state *, struct json_object *, struct json_object *, const char *, void *); + struct json_object *(*set_type)(struct json_object *, struct json_object *, const char *, void *); void **(*get_type)(struct json_object *, const char *); - struct json_object *(*new_object)(struct ut_state *, struct json_object *); + struct json_object *(*new_object)(struct json_object *); }; extern const struct ut_ops ut; +#define register_functions(ops, functions, scope) \ + if (scope) \ + for (int i = 0; i < ARRAY_SIZE(functions); i++) \ + ops->register_function(scope, functions[i].name, functions[i].func) + void ut_module_init(const struct ut_ops *, struct ut_state *, struct json_object *); #endif /* __MODULE_H_ */ |