mirror of
git://git.sv.gnu.org/nano.git
synced 2025-01-10 03:22:04 +03:00
tweaks: use an intermediate variable, to avoid using one for two purposes
This commit is contained in:
parent
c3a53cffbc
commit
87612582ff
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user