summaryrefslogtreecommitdiffhomepage
path: root/module.h
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-09-10 16:34:12 +0200
committerJo-Philipp Wich <jo@mein.io>2020-09-10 16:35:13 +0200
commit39164c57d893b02f9a253c661abc2459bcd57e5c (patch)
tree7df7bb35122bc692818feb883726e5910b892101 /module.h
parentd33d86fae9b72b352a335488e2e1401e3b0c66a1 (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.h11
1 files changed, 8 insertions, 3 deletions
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_ */