MEDIUM: init: convert all trivial registration calls to initcalls
This switches explicit calls to various trivial registration methods for
keywords, muxes or protocols from constructors to INITCALL1 at stage
STG_REGISTER. All these calls have in common to consume a single pointer
and return void. Doing this removes 26 constructors. The following calls
were addressed :
- acl_register_keywords
- bind_register_keywords
- cfg_register_keywords
- cli_register_kw
- flt_register_keywords
- http_req_keywords_register
- http_res_keywords_register
- protocol_register
- register_mux_proto
- sample_register_convs
- sample_register_fetches
- srv_register_keywords
- tcp_req_conn_keywords_register
- tcp_req_cont_keywords_register
- tcp_req_sess_keywords_register
- tcp_res_cont_keywords_register
- flt_register_keywords
diff --git a/src/cli.c b/src/cli.c
index 3f43862..b8b2335 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -30,6 +30,7 @@
#include <common/compat.h>
#include <common/config.h>
#include <common/debug.h>
+#include <common/initcall.h>
#include <common/memory.h>
#include <common/mini-clist.h>
#include <common/standard.h>
@@ -2449,11 +2450,15 @@
{{},}
}};
+INITCALL1(STG_REGISTER, cli_register_kw, &cli_kws);
+
static struct cfg_kw_list cfg_kws = {ILH, {
{ CFG_GLOBAL, "stats", stats_parse_global },
{ 0, NULL, NULL },
}};
+INITCALL1(STG_REGISTER, cfg_register_keywords, &cfg_kws);
+
static struct bind_kw_list bind_kws = { "STAT", { }, {
{ "level", bind_parse_level, 1 }, /* set the unix socket admin level */
{ "expose-fd", bind_parse_expose_fd, 1 }, /* set the unix socket expose fd rights */
@@ -2461,13 +2466,7 @@
{ NULL, NULL, 0 },
}};
-__attribute__((constructor))
-static void __dumpstats_module_init(void)
-{
- cfg_register_keywords(&cfg_kws);
- cli_register_kw(&cli_kws);
- bind_register_keywords(&bind_kws);
-}
+INITCALL1(STG_REGISTER, bind_register_keywords, &bind_kws);
/*
* Local variables: