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/filters.c b/src/filters.c
index bdc106a..edce603 100644
--- a/src/filters.c
+++ b/src/filters.c
@@ -16,6 +16,7 @@
#include <common/compat.h>
#include <common/config.h>
#include <common/errors.h>
+#include <common/initcall.h>
#include <common/namespace.h>
#include <common/standard.h>
#include <common/hathreads.h>
@@ -1189,12 +1190,13 @@
}
};
+INITCALL1(STG_REGISTER, cfg_register_keywords, &cfg_kws);
+
__attribute__((constructor))
static void
__filters_init(void)
{
pool_head_filter = create_pool("filter", sizeof(struct filter), MEM_F_SHARED);
- cfg_register_keywords(&cfg_kws);
hap_register_post_check(flt_init_all);
hap_register_per_thread_init(flt_init_all_per_thread);
hap_register_per_thread_deinit(flt_deinit_all_per_thread);