From 4c4d4d3eb3fd2bdeefb034a524f02b803f4583ab Mon Sep 17 00:00:00 2001 From: Baptiste Jonglez Date: Thu, 31 May 2012 18:11:53 +0200 Subject: 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 Signed-off-by: Lukas Fleischer --- src/calendar.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/calendar.c') 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); -- cgit v1.2.3-54-g00ecf