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/utils.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index d756d62..0a28620 100644 --- a/src/utils.c +++ b/src/utils.c @@ -212,7 +212,8 @@ popup (int pop_row, int pop_col, int pop_y, int pop_x, char *title, char *msg, /* prints in middle of a panel */ void -print_in_middle (WINDOW *win, int starty, int startx, int width, char *string) +print_in_middle (WINDOW *win, int starty, int startx, int width, + const char *string) { int len = strlen (string); int x, y; @@ -490,17 +491,17 @@ void print_bool_option_incolor (WINDOW *win, unsigned option, int pos_y, int pos_x) { int color = 0; - char option_value[BUFSIZ] = ""; + const char *option_value; if (option == 1) { color = ATTR_TRUE; - strncpy (option_value, _("yes"), BUFSIZ); + option_value = _("yes"); } else if (option == 0) { color = ATTR_FALSE; - strncpy (option_value, _("no"), BUFSIZ); + option_value = _("no"); } else EXIT (_("option not defined")); -- cgit v1.2.3-54-g00ecf