From 39164c57d893b02f9a253c661abc2459bcd57e5c Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 10 Sep 2020 16:34:12 +0200 Subject: treewide: eliminate unused function arguments Also introduce convenience macro for registering function arrays in modules. Signed-off-by: Jo-Philipp Wich --- module.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'module.h') diff --git a/module.h b/module.h index 4787d60..5e73fd9 100644 --- a/module.h +++ b/module.h @@ -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_ */ -- cgit v1.2.3