]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cfgparse: New function cfg_unregister_sections()
authorDavid Carlier <dcarlier@afilias.info>
Fri, 25 Sep 2015 10:49:18 +0000 (11:49 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 28 Sep 2015 12:00:00 +0000 (14:00 +0200)
A new function introduced meant to be called during general deinit phase.
During the configuration parsing, the section entries are all allocated.
This new function free them.

include/common/cfgparse.h
src/cfgparse.c

index 86a0035145ffc96357951c013be6866f29a7c994..d7853277114c9707cc0fc5c995fd4175ace7688d 100644 (file)
@@ -73,6 +73,7 @@ int check_config_validity();
 int str2listener(char *str, struct proxy *curproxy, struct bind_conf *bind_conf, const char *file, int line, char **err);
 int cfg_register_section(char *section_name,
                          int (*section_parser)(const char *, int, char **, int));
+void cfg_unregister_sections(void);
 int warnif_misplaced_tcp_conn(struct proxy *proxy, const char *file, int line, const char *arg);
 int warnif_misplaced_tcp_cont(struct proxy *proxy, const char *file, int line, const char *arg);
 
index d732ac3286144e4c7a36e9cd94fb6f011a964afe..b40588fb6ed75df0e99e7012fdb7f5246cff8594 100644 (file)
@@ -8846,6 +8846,19 @@ int cfg_register_section(char *section_name,
        return 1;
 }
 
+/*
+ * free all config section entries
+ */
+void cfg_unregister_sections(void)
+{
+       struct cfg_section *cs, *ics;
+
+       list_for_each_entry_safe(cs, ics, &sections, list) {
+               LIST_DEL(&cs->list);
+               free(cs);
+       }
+}
+
 /*
  * Local variables:
  *  c-indent-level: 8