diff --git a/ChangeLog b/ChangeLog index c7b8818e6ebc295141c01fca04c16a03b4e0e0fe..816d49c3b6f701e7f0be336df0b9eedee486ee2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2014-05-04 Benno Schulenberg <bensberg@justemail.net> + * src/winio.c (statusbar): Elide a variable. + 2014-05-03 Benno Schulenberg <bensberg@justemail.net> * 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 e60fe1b5c23ca2085a2481e35c0debed40375fb0..7cf5db61c6c2c1a2beee0f6b52be3a7f7fb647f4 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]);