]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: da: register the config keywords in da.c
authorWilly Tarreau <w@1wt.eu>
Mon, 1 Jun 2015 13:42:29 +0000 (15:42 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 2 Jun 2015 11:42:12 +0000 (13:42 +0200)
No need to export the registration to haproxy.c, it can be done
locally.

include/import/da.h
src/da.c
src/haproxy.c

index 1c110d0745c827ab8c7270d60a24a3eddd08e6c6..e1de985ec82ae9be3597449f47b776ffb0a34ec2 100644 (file)
@@ -5,7 +5,6 @@
 #include <types/global.h>
 #include <dac.h>
 
-void da_register_cfgkeywords(void);
 int init_deviceatlas(void);
 void deinit_deviceatlas(void);
 #endif
index 03b4b3e89f4248cd44bbd7146d70287ec615e57f..435cc3fd3e0a0d9a16378cd4a19df0234601862d 100644 (file)
--- a/src/da.c
+++ b/src/da.c
@@ -52,13 +52,6 @@ static int da_property_separator(char **args, int section_type, struct proxy *cu
        return 0;
 }
 
-static struct cfg_kw_list dacfg_kws = {{ }, {
-       { CFG_GLOBAL, "deviceatlas-json-file",    da_json_file },
-       { CFG_GLOBAL, "deviceatlas-log-level",    da_log_level },
-       { CFG_GLOBAL, "deviceatlas-property-separator", da_property_separator },
-       { 0, NULL, NULL },
-}};
-
 static size_t da_haproxy_read(void *ctx, size_t len, char *buf)
 {
        return fread(buf, 1, len, ctx);
@@ -79,11 +72,6 @@ static void da_haproxy_log(da_severity_t severity, da_status_t status,
        }
 }
 
-void da_register_cfgkeywords(void)
-{
-       cfg_register_keywords(&dacfg_kws);
-}
-
 int init_deviceatlas(void)
 {
        da_status_t status = DA_SYS;
@@ -231,6 +219,13 @@ static int da_haproxy(const struct arg *args, struct sample *smp, void *private)
        return 1;
 }
 
+static struct cfg_kw_list dacfg_kws = {{ }, {
+       { CFG_GLOBAL, "deviceatlas-json-file",    da_json_file },
+       { CFG_GLOBAL, "deviceatlas-log-level",    da_log_level },
+       { CFG_GLOBAL, "deviceatlas-property-separator", da_property_separator },
+       { 0, NULL, NULL },
+}};
+
 /* Note: must not be declared <const> as its list will be overwritten */
 static struct sample_conv_kw_list conv_kws = {ILH, {
        { "da-csv", da_haproxy, ARG5(1,STR,STR,STR,STR,STR), NULL, SMP_T_STR, SMP_T_STR },
@@ -242,5 +237,6 @@ static void __da_init(void)
 {
        /* register sample fetch and format conversion keywords */
        sample_register_convs(&conv_kws);
+       cfg_register_keywords(&dacfg_kws);
 }
 #endif
index a8ea22eeb9900447c932febb8b2377c8a0605271..7413d659fa8fea2d7b26a0d87311e1301a110e86 100644 (file)
@@ -583,10 +583,6 @@ void init(int argc, char **argv)
 
        /* Initialise lua. */
        hlua_init();
-#if defined(USE_DEVICEATLAS)
-       /* Register deviceatlas config keywords */
-       da_register_cfgkeywords();
-#endif
 
        global.tune.options |= GTUNE_USE_SELECT;  /* select() is always available */
 #if defined(ENABLE_POLL)