]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
df: tune slightly
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 26 Jul 2018 08:56:28 +0000 (01:56 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 27 Jul 2018 01:19:45 +0000 (18:19 -0700)
* src/df.c (get_header, get_dev):
Avoid calling mbswidth twice when once will do.

src/df.c

index d27ba029c4942c477a287d4aa22ac1cb9db34224..9b6587273187acce0b7ce7ebd59ac3d39a5c524e 100644 (file)
--- a/src/df.c
+++ b/src/df.c
@@ -595,7 +595,8 @@ get_header (void)
 
       table[nrows - 1][col] = cell;
 
-      columns[col]->width = MAX (columns[col]->width, mbswidth (cell, 0));
+      size_t cell_width = mbswidth (cell, 0);
+      columns[col]->width = MAX (columns[col]->width, cell_width);
     }
 }
 
@@ -1205,7 +1206,8 @@ get_dev (char const *disk, char const *mount_point, char const* file,
         assert (!"empty cell");
 
       hide_problematic_chars (cell);
-      columns[col]->width = MAX (columns[col]->width, mbswidth (cell, 0));
+      size_t cell_width = mbswidth (cell, 0);
+      columns[col]->width = MAX (columns[col]->width, cell_width);
       table[nrows - 1][col] = cell;
     }
   free (dev_name);