nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 99607a5bbeee1984c163d857ae10c7494c5e6cf6
parent 7e807cdd2ff73f45087b56e318dfb6f5117c0ece
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue, 12 Oct 2021 17:11:52 +0200

tweaks: invert a condition, to get an early return instead of indentation

Diffstat:
Msrc/history.c | 20++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git 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); - } + for (item = position_history; item != NULL; item = nextone) { + nextone = item->next; + free(item->filename); + free(item); + } - position_history = NULL; + position_history = NULL; - load_poshistory(); - } + load_poshistory(); } /* Update the recorded last file positions with the current position in the