]> git.neil.brown.name Git - edlib.git/commitdiff
config: allow the TESTING and NOTESTING prefix to apply to every line.
authorNeilBrown <neil@brown.name>
Sun, 3 Sep 2023 09:39:56 +0000 (19:39 +1000)
committerNeilBrown <neil@brown.name>
Mon, 4 Sep 2023 23:07:53 +0000 (09:07 +1000)
We might want any config item to apply differently in testing,
so make that possible.

Signed-off-by: NeilBrown <neil@brown.name>
lib-config.c

index ecff730fb525d9a51d2cf95989c37ffad53c3dd6..c6aa89ba699602e278971496635de87cb511eefc 100644 (file)
@@ -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);