Skip to content

Commit efb1d77

Browse files
committed
config: add new config format list
Signed-off-by: Eduardo Silva <[email protected]>
1 parent 1b89b47 commit efb1d77

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

include/fluent-bit/flb_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct flb_config {
7272

7373
/* main configuration */
7474
struct flb_cf *cf_main;
75-
struct flb_cf *cf_parsers;
75+
struct mk_list cf_parsers_list;
7676

7777
flb_sds_t program_name; /* argv[0] */
7878

src/flb_config.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,6 @@ struct flb_config *flb_config_init()
199199
return NULL;
200200
}
201201

202-
/* config_format for parsers */
203-
config->cf_parsers = flb_cf_create();
204-
205202
/* Flush */
206203
config->flush = FLB_CONFIG_FLUSH_SECS;
207204
config->daemon = FLB_FALSE;
@@ -284,6 +281,7 @@ struct flb_config *flb_config_init()
284281
mk_list_init(&config->workers);
285282
mk_list_init(&config->upstreams);
286283
mk_list_init(&config->cmetrics);
284+
mk_list_init(&config->cf_parsers_list);
287285

288286
memset(&config->tasks_map, '\0', sizeof(config->tasks_map));
289287

@@ -326,6 +324,7 @@ void flb_config_exit(struct flb_config *config)
326324
{
327325
struct mk_list *tmp;
328326
struct mk_list *head;
327+
struct flb_cf *cf;
329328
struct flb_input_collector *collector;
330329

331330
if (config->log_file) {
@@ -478,9 +477,14 @@ void flb_config_exit(struct flb_config *config)
478477
if (config->cf_main) {
479478
flb_cf_destroy(config->cf_main);
480479
}
481-
if (config->cf_parsers) {
482-
flb_cf_destroy(config->cf_parsers);
480+
481+
/* remove parsers */
482+
mk_list_foreach_safe(head, tmp, &config->cf_parsers_list) {
483+
cf = mk_list_entry(head, struct flb_cf, _head);
484+
mk_list_del(&cf->_head);
485+
flb_cf_destroy(cf);
483486
}
487+
484488
flb_free(config);
485489
}
486490

0 commit comments

Comments
 (0)