From b10cbf5c1c779588a29644b23f82fe36e87a746b Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Mon, 1 Jul 2024 13:53:29 +0200 Subject: [PATCH] export: small simplification use pares_options always (even with NULL) --- src/export.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/export.c b/src/export.c index 27098676e..3edb0560b 100644 --- a/src/export.c +++ b/src/export.c @@ -105,6 +105,9 @@ static void usage() { static bool parse_options(struct exporter *s, const char *ccfg, bool *should_export) { + if (ccfg == NULL) { + return true; + } char buf[STR_LEN]; snprintf(buf, sizeof buf, "%s", ccfg); char *cfg = buf; @@ -149,16 +152,10 @@ struct exporter *export_init(struct module *parent, const char *cfg, bool should pthread_mutex_init(&s->lock, NULL); s->limit = -1; - if (cfg) { - if (strcmp(cfg, "help") == 0) { - usage(); - export_destroy(s); - return NULL; - } - if (!parse_options(s, cfg, &should_export)) { - HANDLE_ERROR - } - } else { + if (!parse_options(s, cfg, &should_export)) { + HANDLE_ERROR + } + if (s->dir == NULL) { s->dir_auto = true; }