From e43939dd843ea7deed52dce6c7019773e14314d8 Mon Sep 17 00:00:00 2001 From: Sebastian LaVine Date: Mon, 18 Oct 2021 21:52:50 -0400 Subject: [PATCH] Remove MAX() and MIN() macros The MAX() macro was never used and the MIN() macro was only used once. The place it was used already has an explanatory comment, which helps to offset the ugliness of the ternary operator. --- main.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/main.c b/main.c index 4250037..93dbcb1 100644 --- a/main.c +++ b/main.c @@ -35,9 +35,6 @@ #include "err.h" -#define MAX(A, B) ((A) > (B) ? (A) : (B)) -#define MIN(A, B) ((A) < (B) ? (A) : (B)) - /* TODO: move these defines to appropriate places when main.c is split. */ #define ST_SIZE_INCR 10 #define FILEL_SIZE_INCR 4 @@ -387,7 +384,7 @@ display_buffer(const Buffer *const b) * print the amount of lines in the file if that is less than * `rows - 1`, to avoid a segfault. */ - linestoprint = MIN(b->st_amt, rows - 1); + linestoprint = (b->st_amt < rows - 1 ? b->st_amt : rows - 1); for (i = 0; i < linestoprint; i++) { int linelen; -- 2.38.4