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/backend.c b/src/backend.c
index e55d87c..5aaa46d 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -24,6 +24,7 @@
#include <common/config.h>
#include <common/debug.h>
#include <common/hash.h>
+#include <common/initcall.h>
#include <common/ticks.h>
#include <common/time.h>
#include <common/namespace.h>
@@ -2073,12 +2074,15 @@
{ /* END */ },
}};
+INITCALL1(STG_REGISTER, sample_register_fetches, &smp_kws);
+
/* Note: must not be declared <const> as its list will be overwritten */
static struct sample_conv_kw_list sample_conv_kws = {ILH, {
{ "nbsrv", sample_conv_nbsrv, 0, NULL, SMP_T_STR, SMP_T_SINT },
{ /* END */ },
}};
+INITCALL1(STG_REGISTER, sample_register_convs, &sample_conv_kws);
/* Note: must not be declared <const> as its list will be overwritten.
* Please take care of keeping this list alphabetically sorted.
@@ -2087,14 +2091,7 @@
{ /* END */ },
}};
-
-__attribute__((constructor))
-static void __backend_init(void)
-{
- sample_register_fetches(&smp_kws);
- sample_register_convs(&sample_conv_kws);
- acl_register_keywords(&acl_kws);
-}
+INITCALL1(STG_REGISTER, acl_register_keywords, &acl_kws);
/*
* Local variables: