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/cache.c b/src/cache.c
index 2157433..acab99d 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -34,6 +34,7 @@
#include <common/cfgparse.h>
#include <common/hash.h>
+#include <common/initcall.h>
/* flt_cache_store */
@@ -1184,6 +1185,7 @@
{{},}
}};
+INITCALL1(STG_REGISTER, cli_register_kw, &cli_kws);
static struct action_kw_list http_res_actions = {
.kw = {
@@ -1192,6 +1194,8 @@
}
};
+INITCALL1(STG_REGISTER, http_res_keywords_register, &http_res_actions);
+
static struct action_kw_list http_req_actions = {
.kw = {
{ "cache-use", parse_cache_use },
@@ -1199,6 +1203,8 @@
}
};
+INITCALL1(STG_REGISTER, http_req_keywords_register, &http_req_actions);
+
struct applet http_cache_applet = {
.obj_type = OBJ_TYPE_APPLET,
.name = "<CACHE>", /* used for logging */
@@ -1211,9 +1217,5 @@
{
cfg_register_section("cache", cfg_parse_cache, cfg_post_parse_section_cache);
cfg_register_postparser("cache", cfg_cache_postparser);
- cli_register_kw(&cli_kws);
- http_res_keywords_register(&http_res_actions);
- http_req_keywords_register(&http_req_actions);
pool_head_cache_st = create_pool("cache_st", sizeof(struct cache_st), MEM_F_SHARED);
}
-