aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkatherine <ageha@airen-no-jikken.icu>2019-12-21 01:19:27 -0700
committerkatherine <ageha@airen-no-jikken.icu>2019-12-21 01:19:27 -0700
commitabc20333ab9dc27777cac564c9158e357143008c (patch)
treed6bc52ce80363465ccc7504f667347b5bfba2014 /src
parentb4d0efeebd5e81ff7a72a9cb34c4664d1caf4ddd (diff)
downloadevery-abc20333ab9dc27777cac564c9158e357143008c.tar.gz
use entry pointers rather than entries in buf
Diffstat (limited to 'src')
-rw-r--r--src/print.c18
1 files changed, 9 insertions, 9 deletions
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++;
}