aboutsummaryrefslogtreecommitdiffstats
path: root/src/calendar.c
diff options
context:
space:
mode:
authorBaptiste Jonglez <baptiste--git@jonglez.org>2012-05-31 18:11:53 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-05-31 20:27:43 +0200
commit4c4d4d3eb3fd2bdeefb034a524f02b803f4583ab (patch)
tree94b27921dcd22e6b28fb7ba1a25c2a76019bf13d /src/calendar.c
parentbc7c0be84c31633f1b4903b8ae623f5c1cb9395e (diff)
downloadcalcurse-4c4d4d3eb3fd2bdeefb034a524f02b803f4583ab.tar.gz
calcurse-4c4d4d3eb3fd2bdeefb034a524f02b803f4583ab.zip
Use mvwaddstr() instead of mvwprintw()
When we only want to display a string at a specific place of the screen, there's no need to use the more complex mvwprintw(), use mvwaddstr() instead. This should be slightly more efficient, and, above all, it prevents weird things to happen if our string contains a '%', being interpreted as an unwanted format string. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/calendar.c')
-rw-r--r--src/calendar.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/calendar.c b/src/calendar.c
index be39f38..772c177 100644
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -313,8 +313,7 @@ draw_monthly_view(struct window *cwin, struct date *current_day,
/* print the days, with regards to the first day of the week */
custom_apply_attr(cwin->p, ATTR_HIGHEST);
for (j = 0; j < WEEKINDAYS; j++) {
- mvwprintw(cwin->p, ofs_y, ofs_x + 4 * j, "%s",
- _(daynames[1 + j - sunday_first]));
+ mvwaddstr(cwin->p, ofs_y, ofs_x + 4 * j, _(daynames[1 + j - sunday_first]));
}
custom_remove_attr(cwin->p, ATTR_HIGHEST);
@@ -473,8 +472,7 @@ draw_weekly_view(struct window *cwin, struct date *current_day,
/* print the day names, with regards to the first day of the week */
custom_apply_attr(cwin->p, ATTR_HIGHEST);
- mvwprintw(cwin->p, OFFY, OFFX + 4 * j, "%s",
- _(daynames[1 + j - sunday_first]));
+ mvwaddstr(cwin->p, OFFY, OFFX + 4 * j, _(daynames[1 + j - sunday_first]));
custom_remove_attr(cwin->p, ATTR_HIGHEST);
/* Check if the day to be printed has an item or not. */
@@ -515,8 +513,8 @@ draw_weekly_view(struct window *cwin, struct date *current_day,
if (highlight)
custom_apply_attr(cwin->p, attr);
wattron(cwin->p, A_REVERSE);
- mvwprintw(cwin->p, OFFY + 2 + i, OFFX + 1 + 4 * j, " ");
- mvwprintw(cwin->p, OFFY + 2 + i, OFFX + 2 + 4 * j, " ");
+ mvwaddstr(cwin->p, OFFY + 2 + i, OFFX + 1 + 4 * j, " ");
+ mvwaddstr(cwin->p, OFFY + 2 + i, OFFX + 2 + 4 * j, " ");
wattroff(cwin->p, A_REVERSE);
if (highlight)
custom_remove_attr(cwin->p, attr);