From: Yu Watanabe Date: Tue, 26 Sep 2023 16:29:11 +0000 (+0900) Subject: sd-journal: merge two bump_entry_array() calls X-Git-Tag: v255-rc1~374^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b63f09e4ee5ccfbb764e996154d78953093d9132;p=thirdparty%2Fsystemd.git sd-journal: merge two bump_entry_array() calls No functional changes, just refactoring. --- diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c index 22de80bac0f..5371c6d79bd 100644 --- a/src/libsystemd/sd-journal/journal-file.c +++ b/src/libsystemd/sd-journal/journal-file.c @@ -2752,7 +2752,7 @@ static int generic_array_get( uint64_t a, t = 0, k; ChainCacheItem *ci; - Object *o; + Object *o = NULL; int r; assert(f); @@ -2781,12 +2781,7 @@ static int generic_array_get( /* If there's corruption and we're going upwards, move back to the previous entry * array and start iterating entries from there. */ - r = bump_entry_array(f, NULL, a, first, DIRECTION_UP, &a); - if (r <= 0) - return r; - i = UINT64_MAX; - break; } if (r < 0) @@ -2808,6 +2803,10 @@ static int generic_array_get( /* In the first iteration of the while loop, we reuse i, k and o from the previous while * loop. */ if (i == UINT64_MAX) { + r = bump_entry_array(f, o, a, first, direction, &a); + if (r <= 0) + return r; + r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o); if (r < 0) return r; @@ -2843,10 +2842,6 @@ static int generic_array_get( } while (bump_array_index(&i, direction, k) > 0); - r = bump_entry_array(f, o, a, first, direction, &a); - if (r <= 0) - return r; - t += k; i = UINT64_MAX; }