From 481cb5524f8e165bbe3c17bb04bdc7330dd7a923 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 2 Mar 2012 09:28:13 +0100 Subject: Do not strncpy() strings returned by gettext() Translated strings returned by gettext() are statically allocated. There's no need to copy them to a buffer, we can use the pointers returned by gettext() instead. Signed-off-by: Lukas Fleischer --- src/wins.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/wins.c') diff --git a/src/wins.c b/src/wins.c index fa53dcb..6c74d0f 100644 --- a/src/wins.c +++ b/src/wins.c @@ -224,21 +224,16 @@ wins_slctd_next (void) static void wins_init_panels (void) { - char label[BUFSIZ]; - win[CAL].p = newwin (CALHEIGHT, wins_sbar_width (), win[CAL].y, win[CAL].x); - strncpy (label, _("Calendar"), BUFSIZ); - wins_show (win[CAL].p, label); + wins_show (win[CAL].p, _("Calendar")); win[APP].p = newwin (win[APP].h, win[APP].w, win[APP].y, win[APP].x); - strncpy (label, _("Appointments"), BUFSIZ); - wins_show (win[APP].p, label); + wins_show (win[APP].p, _("Appointments")); apad.width = win[APP].w - 3; apad.ptrwin = newpad (apad.length, apad.width); win[TOD].p = newwin (win[TOD].h, win[TOD].w, win[TOD].y, win[TOD].x); - strncpy (label, _("ToDo"), BUFSIZ); - wins_show (win[TOD].p, label); + wins_show (win[TOD].p, _("ToDo")); /* Enable function keys (i.e. arrow keys) in those windows */ keypad (win[CAL].p, TRUE); @@ -353,7 +348,7 @@ wins_reinit (void) /* Show the window with a border and a label. */ void -wins_show (WINDOW *win, char *label) +wins_show (WINDOW *win, const char *label) { int width = getmaxx (win); -- cgit v1.2.3-54-g00ecf