From 2bf02493385ffe5e51b5480e57f9643bc80b8267 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 11 Oct 2011 13:06:55 +0200 Subject: 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 --- src/args.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/args.c') diff --git a/src/args.c b/src/args.c index 6670ce0..5e50c03 100644 --- a/src/args.c +++ b/src/args.c @@ -432,6 +432,7 @@ app_arg (int add_line, struct date *day, long date, int print_note, { struct apoint *apt = LLIST_TS_GET_DATA (i); struct recur_apoint *ra = LLIST_TS_GET_DATA (j); + unsigned occurrence; while (i && regex && regexec (regex, apt->mesg, 0, 0, 0) != 0) { @@ -447,7 +448,8 @@ app_arg (int add_line, struct date *day, long date, int print_note, if (apt && ra) { - if (apt->start <= recur_apoint_inday (ra, today)) + if (recur_apoint_find_occurrence (ra, today, &occurrence) && + apt->start <= occurrence) ra = NULL; else apt = NULL; -- cgit v1.2.3-54-g00ecf