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/custom.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/custom.c')
-rw-r--r-- | src/custom.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/custom.c b/src/custom.c index 900c869..2ccae65 100644 --- a/src/custom.c +++ b/src/custom.c @@ -215,7 +215,7 @@ custom_layout_config (void) struct scrollwin hwin; struct window conf_win; int ch, mark, cursor, need_reset; - char label[BUFSIZ]; + const char *label = _("layout configuration"); char *help_text = _("With this configuration menu, one can choose where panels will be\n" "displayed inside calcurse screen. \n" @@ -226,7 +226,6 @@ custom_layout_config (void) " 't' -> todo panel\n\n"); conf_win.p = NULL; - strncpy (label, _("layout configuration"), BUFSIZ); custom_confwin_init (&conf_win, label); cursor = mark = wins_layout () - 1; display_layout_config (&conf_win, mark, cursor); @@ -374,7 +373,7 @@ set_confwin_attr (struct window *cwin) * (useful in case of window resize). */ void -custom_confwin_init (struct window *confwin, char *label) +custom_confwin_init (struct window *confwin, const char *label) { if (confwin->p) { @@ -547,10 +546,9 @@ custom_color_config (void) struct window conf_win; int ch, cursor, need_reset, theme_changed; int mark_fore, mark_back; - char label[BUFSIZ]; + const char *label = _("color theme"); conf_win.p = 0; - strncpy (label, _("color theme"), BUFSIZ); custom_confwin_init (&conf_win, label); mark_fore = NBUSERCOLORS; mark_back = SIZE - 1; @@ -764,7 +762,7 @@ custom_general_config (void) clear (); custom_set_swsiz (&cwin); - strncpy (cwin.label, _("general options"), BUFSIZ); + cwin.label = _("general options"); wins_scrollwin_init (&cwin); wins_show (cwin.win.p, cwin.label); status_mesg (number_str, keys); @@ -969,7 +967,7 @@ custom_keys_config (void) clear (); custom_set_swsiz (&kwin); nbdisplayed = (kwin.win.h - LABELLINES) / LINESPERKEY; - strncpy (kwin.label, _("keys configuration"), BUFSIZ); + kwin.label = _("keys configuration"); wins_scrollwin_init (&kwin); wins_show (kwin.win.p, kwin.label); custom_keys_config_bar (); |