From 99607a5bbeee1984c163d857ae10c7494c5e6cf6 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 12 Oct 2021 17:11:52 +0200 Subject: [PATCH] tweaks: invert a condition, to get an early return instead of indentation --- src/history.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/history.c b/src/history.c index 9cf080e0..01669cf0 100644 --- a/src/history.c +++ b/src/history.c @@ -469,21 +469,21 @@ void save_poshistory(void) /* Reload the position history file if it has been modified since last load. */ void reload_positions_if_needed(void) { + poshiststruct *item, *nextone; struct stat fileinfo; - if (stat(poshistname, &fileinfo) == 0 && fileinfo.st_mtime != latest_timestamp) { - poshiststruct *item, *nextone; + if (stat(poshistname, &fileinfo) != 0 || fileinfo.st_mtime == latest_timestamp) + return; - for (item = position_history; item != NULL; item = nextone) { - nextone = item->next; - free(item->filename); - free(item); - } - - position_history = NULL; - - load_poshistory(); + for (item = position_history; item != NULL; item = nextone) { + nextone = item->next; + free(item->filename); + free(item); } + + position_history = NULL; + + load_poshistory(); } /* Update the recorded last file positions with the current position in the