X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=gui.c;h=6e44b09d37cc574846f1de0a4d325e586c69dad0;hb=e90c6c0a4d28a3f39e671c74ffe7c3de64650aa7;hp=a34f27de5e40cb0adbb2d652d18586c955d88a90;hpb=20e2c6a532dcb0c197062b9f97753e000eae3c6a;p=paraslash.git diff --git a/gui.c b/gui.c index a34f27de..6e44b09d 100644 --- a/gui.c +++ b/gui.c @@ -287,14 +287,20 @@ static char *configfile_exists(void) return file_exists(tmp)? tmp: NULL; } -/* - * print num spaces to curses window - */ +/* Print given number of spaces to curses window. */ static void add_spaces(WINDOW* win, unsigned int num) { - while (num > 0) { - num--; - waddstr(win, " "); + char space[] = " "; + unsigned sz = sizeof(space); + + while (num >= sz) { + waddstr(win, space); + num -= sz; + } + if (num > 0) { + assert(num < sz); + space[num] = '\0'; + waddstr(win, space); } }