Commit 46f0028c6413ca50100c33dac0c58f1502fd1f1b

Stefan Sperling 2019-01-24T20:41:39

tog: simplify loop condition in tree_scroll_down()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/tog/tog.c b/tog/tog.c
index 43dcf33..fa7abed 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -3046,10 +3046,8 @@ tree_scroll_down(struct got_tree_entry **first_displayed_entry, int maxscroll,
 		next = SIMPLEQ_NEXT(*first_displayed_entry, entry);
 	else
 		next = SIMPLEQ_FIRST(&entries->head);
-	while (next) {
+	while (next && n++ < maxscroll) {
 		*first_displayed_entry = next;
-		if (++n >= maxscroll)
-			break;
 		next = SIMPLEQ_NEXT(next, entry);
 	}
 }