commit d8efe6c42f241d9d0daa34a76dd9ab09b9215392
parent 5c4df86144f3ec99bc302f0f5d3b8972e8d1b7f9
Author: Matthias Beyer <mail@beyermatthias.de>
Date: Fri, 18 Nov 2016 14:43:21 +0100
Move constant out of function, minify iteration
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/diary.c b/diary.c
@@ -16,11 +16,11 @@ char curs_date_str[70];
struct tm cal_start;
struct tm cal_end;
+static const char* WEEKDAYS[] = {"Mo","Tu","We","Th","Fr","Sa","Su",0};
+
void draw_wdays(WINDOW* head) {
- char* weekdays[] = {"Mo","Tu","We","Th","Fr","Sa","Su"};
- int wd;
- for (wd = 0; wd < sizeof(weekdays)/sizeof(weekdays[0]); wd++) {
- waddstr(head, weekdays[wd]);
+ for (char* wd = WEEKDAYS; *wd; wd++) {
+ waddstr(head, wd);
waddch(head, ' ');
}
wrefresh(head);