]> git.neil.brown.name Git - edlib.git/commitdiff
rangetrack: fix some status returns.
authorNeilBrown <neil@brown.name>
Wed, 4 Oct 2023 06:00:33 +0000 (17:00 +1100)
committerNeilBrown <neil@brown.name>
Wed, 4 Oct 2023 06:00:33 +0000 (17:00 +1100)
If the range name isn't registered yet, report 'false', not 'fail'.
It might be a simple test to see if there is a registration.

And rangetrack:clear should succeed if there is nothing to clear.

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

index bd47b00ed521e2cba821b5ad93900206c4c33f80..16d74654501de1d2c0eaaaf5f4a73b06b1647ed9 100644 (file)
@@ -110,7 +110,7 @@ DEF_CMD(rangetrack_add)
        struct mark *m, *m1, *m2;
 
        if (!i)
-               return Efail;
+               return Efalse;
        if (!start || !end)
                /* Testing if configured already */
                return 1;
@@ -182,7 +182,7 @@ DEF_CMD(rangetrack_clear)
        struct mark *m1, *m2;
 
        if (!i)
-               return Efail;
+               return Efalse;
        if (!start || !end) {
                start = vmark_first(ci->home, i->view, ci->home);
                end = vmark_last(ci->home, i->view, ci->home);
@@ -234,7 +234,7 @@ DEF_CMD(rangetrack_clear)
                mark_step(m2, 0);
        }
        if (!m2)
-               return Efail;
+               return 1;
        /* m2 is now the end of an active section that needs to bie discarded */
        while (m1 && mark_ordered_not_same(m1, m2)) {
                struct mark *m = m1;