>From e40ae8fb26fd0c8c0cb7e42598a2b8d9bd8551bb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 26 Jul 2018 01:56:28 -0700 Subject: [PATCH 2/2] df: tune slightly * src/df.c (get_header, get_dev): Avoid calling mbswidth twice when once will do. --- src/df.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/df.c b/src/df.c index 52be414b..f5bd26d 100644 --- a/src/df.c +++ b/src/df.c @@ -588,7 +588,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); } } @@ -1198,7 +1199,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); -- 2.7.4