From: Yu Watanabe Date: Tue, 2 Jan 2024 19:30:18 +0000 (+0900) Subject: sd-journal: drop duplicated tests in generic_array_bisect() X-Git-Tag: v256-rc1~908^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=821d55a8d7b97ec346407290afb44517d197a0c7;p=thirdparty%2Fsystemd.git sd-journal: drop duplicated tests in generic_array_bisect() When left == right (== 0), generic_array_bisec_step() does not update left and right. So the following test is exactly the same. --- diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c index c9ff6abca65..d3ce5fa7ec9 100644 --- a/src/libsystemd/sd-journal/journal-file.c +++ b/src/libsystemd/sd-journal/journal-file.c @@ -3047,7 +3047,7 @@ static int generic_array_bisect( left = 0; right = m - 1; - if (direction == DIRECTION_UP) { + if (direction == DIRECTION_UP && left < right) { /* If we're going upwards, the last entry of the previous array may pass the test, * and the first entry of the current array may not pass. In that case, the last * entry of the previous array must be returned. Hence, we need to test the first