diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-03-02 09:28:13 +0100 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-03-12 20:36:22 +0100 |
commit | 481cb5524f8e165bbe3c17bb04bdc7330dd7a923 (patch) | |
tree | 34c4c09613e40c82a9bab4b15685cad949d7ce1c /src/utils.c | |
parent | 0f4b45e62487e32e789571912fd2190168f753bc (diff) | |
download | calcurse-481cb5524f8e165bbe3c17bb04bdc7330dd7a923.zip |
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 <calcurse@cryptocrack.de>
Diffstat (limited to 'src/utils.c')
-rw-r--r-- | src/utils.c | 9 |
1 files changed, 5 insertions, 4 deletions
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")); |