summaryrefslogtreecommitdiff
path: root/src/day.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2011-10-11 13:06:55 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2011-10-21 08:58:54 +0200
commit2bf02493385ffe5e51b5480e57f9643bc80b8267 (patch)
tree3c791cc59ef006c689c7c2bda79e3a2222ecf51b /src/day.c
parent28c98f7d0136b4a533e26f076886aa242c709f1c (diff)
downloadcalcurse-2bf02493385ffe5e51b5480e57f9643bc80b8267.zip
Avoid unnecessary start time calculations
Rename recur_*_inday() to recur_*_find_occurrence() and use the new functions whenever we actually care about the start time of an occurrence. Reintroduce recur_*_inday() as wrappers to recur_*_find_occurrence() and pass NULL as start time buffer (which means "skip start time calculation"). Keep using these when we only want to know if a recurrent item belongs to a specific day but do not care about the actual start time. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/day.c')
-rw-r--r--src/day.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/day.c b/src/day.c
index b264887..b75a7bd 100644
--- a/src/day.c
+++ b/src/day.c
@@ -225,10 +225,13 @@ day_store_recur_apoints (long date)
LLIST_TS_FIND_FOREACH (&recur_alist_p, date, recur_apoint_inday, i)
{
struct recur_apoint *rapt = LLIST_TS_GET_DATA (i);
- int real_start = recur_apoint_inday (rapt, date);
- (void)day_add_apoint (RECUR_APPT, rapt->mesg, rapt->note, real_start,
- rapt->dur, rapt->state, a_nb);
- a_nb++;
+ unsigned real_start;
+ if (recur_apoint_find_occurrence (rapt, date, &real_start))
+ {
+ (void)day_add_apoint (RECUR_APPT, rapt->mesg, rapt->note, real_start,
+ rapt->dur, rapt->state, a_nb);
+ a_nb++;
+ }
}
LLIST_TS_UNLOCK (&recur_alist_p);