summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBert Münnich <ber.t@posteo.de>2018-06-10 12:39:23 +0200
committerBert Münnich <ber.t@posteo.de>2018-06-10 12:39:23 +0200
commit1613b42411788810d73252ac86952b3e66c866ba (patch)
tree7c228640cae78710da48be3d3ac5d0d66bc33366
parent1de5f06f83408243211ba7872a15324fec7e3e01 (diff)
downloadnsxiv-1613b42411788810d73252ac86952b3e66c866ba.tar.zst
Simplify cg_mark_range further
-rw-r--r--commands.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/commands.c b/commands.c
index d2917bb..f685bc0 100644
--- a/commands.c
+++ b/commands.c
@@ -212,13 +212,11 @@ bool cg_reverse_marks(arg_t _)
bool cg_mark_range(arg_t _)
{
- int d = markidx < fileidx ? 1 : -1;
+ int d = markidx < fileidx ? 1 : -1, end, i;
bool dirty = false, on = !!(files[markidx].flags & FF_MARK);
- while (markidx != fileidx) {
- if (mark_image(markidx + d, on))
- dirty = true;
- }
+ for (i = markidx + d, end = fileidx + d; i != end; i += d)
+ dirty |= mark_image(i, on);
return dirty;
}