From 87612582ff9975552a20b14ef394b930a6a3fc97 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 13 Feb 2022 12:43:55 +0100 Subject: [PATCH] tweaks: use an intermediate variable, to avoid using one for two purposes --- src/browser.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/browser.c b/src/browser.c index 3a3ec1a4..10c260fa 100644 --- a/src/browser.c +++ b/src/browser.c @@ -50,22 +50,20 @@ void read_the_list(const char *path, DIR *dir) { size_t path_len = strlen(path), index = 0; const struct dirent *entry; - - longest = 0; + size_t widest = 0; /* Find the width of the widest filename in the current folder. */ while ((entry = readdir(dir)) != NULL) { size_t span = breadth(entry->d_name); - if (span > longest) - longest = span; + if (span > widest) + widest = span; index++; } - /* Put 10 characters' worth of blank space between columns of filenames - * in the list whenever possible, as Pico does. */ - longest += 10; + /* Reserve ten columns for blanks plus file size. */ + longest = widest + 10; /* If needed, make room for ".. (parent dir)". */ if (longest < 15)