From abc20333ab9dc27777cac564c9158e357143008c Mon Sep 17 00:00:00 2001 From: katherine Date: Sat, 21 Dec 2019 01:19:27 -0700 Subject: use entry pointers rather than entries in buf --- src/print.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/print.c b/src/print.c index 93ce295..02f78c6 100644 --- a/src/print.c +++ b/src/print.c @@ -45,17 +45,17 @@ static const char *month_names[] = { struct buf_s { time_t rt; - struct entry_s e; + struct entry_s *ep; }; static int buf_cmp(const void *a, const void *b) { const struct buf_s *a1 = a, *b1 = b; - if (b1->e.urgent && !(a1->e.urgent)) + if (b1->ep->urgent && !(a1->ep->urgent)) return 1; - if (a1->e.urgent && !(b1->e.urgent)) + if (a1->ep->urgent && !(b1->ep->urgent)) return -1; if (a1->rt > b1->rt) @@ -127,9 +127,9 @@ void print_console(struct calendar_s *cal) continue; buf[j].rt = *rttmp; - buf[j].e = cal->entries[i]; + buf[j].ep = &(cal->entries[i]); - if (buf[j].e.urgent) + if (buf[j].ep->urgent) has_urgent = true; j++; @@ -144,7 +144,7 @@ void print_console(struct calendar_s *cal) for (i = 0; i < j; i++) { t = *localtime( &(buf[i].rt) ); - if (has_urgent && !urgent_printed && !(buf[i].e.urgent) ) { + if (has_urgent && !urgent_printed && !(buf[i].ep->urgent) ) { printf("\n\n[ normal ]\n\n"); urgent_printed = true; } @@ -181,8 +181,8 @@ void print_console(struct calendar_s *cal) } - if (buf[i].e.msg != NULL) - printf(" %s", buf[i].e.msg); + if (buf[i].ep->msg != NULL) + printf(" %s", buf[i].ep->msg); puts(""); } @@ -212,7 +212,7 @@ void print_script(struct calendar_s *cal) continue; buf[j].rt = *rttmp; - buf[j].e = cal->entries[i]; + buf[j].ep = &(cal->entries[i]); j++; } -- cgit v1.2.3