Browse Source

Simplify if

Jochen Sprickerhof 6 years ago
parent
commit
0ae52bc1bc
1 changed files with 2 additions and 8 deletions
  1. 2 8
      scroll.c

+ 2 - 8
scroll.c

@@ -185,11 +185,8 @@ scrollup(void)
 	write(STDOUT_FILENO, "\033[?25l", 6);
 
 	/* print one page */
-	for (; rows > ws.ws_row; rows--) {
-		if (TAILQ_PREV(bottom, tailhead, entries) == NULL)
-			break;
+	for (; rows > ws.ws_row && TAILQ_PREV(bottom, tailhead, entries) != NULL; rows--) {
 		bottom = TAILQ_PREV(bottom, tailhead, entries);
-
 		write(STDOUT_FILENO, bottom->buf, bottom->size);
 	}
 }
@@ -200,11 +197,8 @@ scrolldown(void)
 	int rows = ws.ws_row;
 
 	/* print one page */
-	for (; rows >= 0; rows--) {
-		if (TAILQ_PREV(bottom, tailhead, entries) == NULL)
-			break;
+	for (; rows >= 0 && TAILQ_PREV(bottom, tailhead, entries) != NULL; rows--) {
 		bottom = TAILQ_PREV(bottom, tailhead, entries);
-
 		write(STDOUT_FILENO, bottom->buf, bottom->size);
 	}
 }