From 0c3ced0d000453e2b5c33470c6055ad9b10b02a4 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 4 May 2014 08:25:09 +0000 Subject: [PATCH] Eliding a variable. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4833 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 +++ src/winio.c | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c7b8818e..816d49c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2014-05-04 Benno Schulenberg + * src/winio.c (statusbar): Elide a variable. + 2014-05-03 Benno Schulenberg * src/*.h, src/*.c: Add the ability to colour four elements of nano's interface differently: title bar, status bar, key combo, diff --git a/src/winio.c b/src/winio.c index e60fe1b5..7cf5db61 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2272,7 +2272,7 @@ void statusbar(const char *msg, ...) { va_list ap; char *bar, *foo; - size_t start_x, foo_len; + size_t start_x; #if !defined(NANO_TINY) && !defined(DISABLE_NANORC) bool old_whitespace; #endif @@ -2297,13 +2297,12 @@ void statusbar(const char *msg, ...) vsnprintf(bar, mb_cur_max() * (COLS - 3), msg, ap); va_end(ap); foo = display_string(bar, 0, COLS - 4, FALSE); + free(bar); #if !defined(NANO_TINY) && !defined(DISABLE_NANORC) if (old_whitespace) SET(WHITESPACE_DISPLAY); #endif - free(bar); - foo_len = strlenpt(foo); - start_x = (COLS - foo_len - 4) / 2; + start_x = (COLS - strlenpt(foo) - 4) / 2; wmove(bottomwin, 0, start_x); wattron(bottomwin, interface_color_pair[STATUS_BAR]);