From: NeilBrown Date: Sun, 3 Sep 2023 09:39:56 +0000 (+1000) Subject: config: allow the TESTING and NOTESTING prefix to apply to every line. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=48c9987969cf16dbc5a8a8b6d5e18ec2d25d24a5;p=edlib.git config: allow the TESTING and NOTESTING prefix to apply to every line. We might want any config item to apply differently in testing, so make that possible. Signed-off-by: NeilBrown --- diff --git a/lib-config.c b/lib-config.c index ecff730f..c6aa89ba 100644 --- a/lib-config.c +++ b/lib-config.c @@ -91,16 +91,6 @@ static void add_trigger(struct config_data *cd safe, unsigned int type, { struct trigger *t = cd->last_trigger; - if (strstarts(name, "TESTING ")) { - if (!edlib_testing(cd->root)) - return; - name += 8; - } - if (strstarts(name, "NOTESTING ")) { - if (edlib_testing(cd->root)) - return; - name += 10; - } if (!t || strcmp(t->path, path) != 0 || t->type != type) { alloc(t, pane); t->path = strdup(path); @@ -184,6 +174,16 @@ static void handle(void *data, char *section safe, char *name safe, char *value return; cd = data; + if (strstarts(name, "TESTING ")) { + if (!edlib_testing(cd->root)) + return; + name += 8; + } + if (strstarts(name, "NOTESTING ")) { + if (edlib_testing(cd->root)) + return; + name += 10; + } if (strcmp(section, "") == 0 || strcmp(section,"include") == 0) { if (strcmp(name, "include") == 0) { load_config(value, data);