From a0d57d0a74449c47ea149360f572e37ede06ea27 Mon Sep 17 00:00:00 2001 From: k21971 Date: Thu, 17 Oct 2019 08:49:22 -0400 Subject: [PATCH] curses - remove unused variable in curses_str_remainder() and remove incorrect use of 'count' which could result in messages being repeated indefiitely. --- win/curses/cursmisc.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/win/curses/cursmisc.c b/win/curses/cursmisc.c index 75e127332..a158b221c 100644 --- a/win/curses/cursmisc.c +++ b/win/curses/cursmisc.c @@ -377,7 +377,6 @@ curses_str_remainder(const char *str, int width, int line_num) int strsize = strlen(str) + 1; #if __STDC_VERSION__ >= 199901L char substr[strsize]; - char curstr[strsize]; char tmpstr[strsize]; strcpy(substr, str); @@ -386,7 +385,6 @@ curses_str_remainder(const char *str, int width, int line_num) #define BUFSZ 256 #endif char substr[BUFSZ * 2]; - char curstr[BUFSZ * 2]; char tmpstr[BUFSZ * 2]; if (strsize > (BUFSZ * 2) - 1) { @@ -414,11 +412,7 @@ curses_str_remainder(const char *str, int width, int line_num) if (last_space == 0) { /* No spaces found */ last_space = count - 1; } - for (count = 0; count < last_space; count++) { - curstr[count] = substr[count]; - } - curstr[count] = '\0'; - if (substr[count] == '\0') { + if (substr[last_space] == '\0') { break; } for (count = (last_space + 1); count < (int) strlen(substr); count++) {