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/stick_table.c b/src/stick_table.c
index 6bddc90..e24ef65 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -15,6 +15,7 @@
#include <errno.h>
#include <common/config.h>
+#include <common/initcall.h>
#include <common/memory.h>
#include <common/mini-clist.h>
#include <common/standard.h>
@@ -3626,6 +3627,7 @@
{{},}
}};
+INITCALL1(STG_REGISTER, cli_register_kw, &cli_kws);
static struct action_kw_list tcp_conn_kws = { { }, {
{ "sc-inc-gpc0", parse_inc_gpc0, 1 },
@@ -3634,6 +3636,8 @@
{ /* END */ }
}};
+INITCALL1(STG_REGISTER, tcp_req_conn_keywords_register, &tcp_conn_kws);
+
static struct action_kw_list tcp_sess_kws = { { }, {
{ "sc-inc-gpc0", parse_inc_gpc0, 1 },
{ "sc-inc-gpc1", parse_inc_gpc1, 1 },
@@ -3641,6 +3645,8 @@
{ /* END */ }
}};
+INITCALL1(STG_REGISTER, tcp_req_sess_keywords_register, &tcp_sess_kws);
+
static struct action_kw_list tcp_req_kws = { { }, {
{ "sc-inc-gpc0", parse_inc_gpc0, 1 },
{ "sc-inc-gpc1", parse_inc_gpc1, 1 },
@@ -3648,6 +3654,8 @@
{ /* END */ }
}};
+INITCALL1(STG_REGISTER, tcp_req_cont_keywords_register, &tcp_req_kws);
+
static struct action_kw_list tcp_res_kws = { { }, {
{ "sc-inc-gpc0", parse_inc_gpc0, 1 },
{ "sc-inc-gpc1", parse_inc_gpc1, 1 },
@@ -3655,6 +3663,8 @@
{ /* END */ }
}};
+INITCALL1(STG_REGISTER, tcp_res_cont_keywords_register, &tcp_res_kws);
+
static struct action_kw_list http_req_kws = { { }, {
{ "sc-inc-gpc0", parse_inc_gpc0, 1 },
{ "sc-inc-gpc1", parse_inc_gpc1, 1 },
@@ -3662,6 +3672,8 @@
{ /* END */ }
}};
+INITCALL1(STG_REGISTER, http_req_keywords_register, &http_req_kws);
+
static struct action_kw_list http_res_kws = { { }, {
{ "sc-inc-gpc0", parse_inc_gpc0, 1 },
{ "sc-inc-gpc1", parse_inc_gpc1, 1 },
@@ -3669,6 +3681,8 @@
{ /* END */ }
}};
+INITCALL1(STG_REGISTER, http_res_keywords_register, &http_res_kws);
+
///* Note: must not be declared <const> as its list will be overwritten.
// * Please take care of keeping this list alphabetically sorted.
// */
@@ -3805,6 +3819,7 @@
{ /* END */ },
}};
+INITCALL1(STG_REGISTER, sample_register_fetches, &smp_fetch_keywords);
/* Note: must not be declared <const> as its list will be overwritten */
static struct sample_conv_kw_list sample_conv_kws = {ILH, {
@@ -3832,19 +3847,4 @@
{ /* END */ },
}};
-__attribute__((constructor))
-static void __stick_table_init(void)
-{
- /* register som action keywords. */
- tcp_req_conn_keywords_register(&tcp_conn_kws);
- tcp_req_sess_keywords_register(&tcp_sess_kws);
- tcp_req_cont_keywords_register(&tcp_req_kws);
- tcp_res_cont_keywords_register(&tcp_res_kws);
- http_req_keywords_register(&http_req_kws);
- http_res_keywords_register(&http_res_kws);
-
- /* register sample fetch and format conversion keywords */
- sample_register_fetches(&smp_fetch_keywords);
- sample_register_convs(&sample_conv_kws);
- cli_register_kw(&cli_kws);
-}
+INITCALL1(STG_REGISTER, sample_register_convs, &sample_conv_kws);