path: root/src/ui-day.c
diff options
authorLars Henriksen <LarsHenriksen@get2net.dk>2019-06-04 09:34:45 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2020-04-28 07:32:44 -0400
commitce81c0fa6362f0092f40eab1cddf0a6339c473c5 (patch)
tree4eac07b3b8ce8c24bc2952034b5410ccb5a48838 /src/ui-day.c
parent3f7bd331c875dd889c4d69537b5408396b0e8f16 (diff)
Refactor function calls: recurrence parameters as a single argument
The recurrence parameters are type, frequency, until date and exception list (in RFC 5545 parlance FREQ, INTERVAL, UNTIL and EXDATE's). When these are passed in a function call, the argument list becomes long and not very readable. When support for extended recurrence rules is implemented, the number of recurrence parameters increases, and function signatures must be amended. Solution: The "struct rpt" is extended with the exception list; any future recurrence parameters are added here. A pointer to this structure replaces the recurrence parameters in function calls. Note: Each recurrent event and appoinment instance has (a pointer to) a "struct rpt" and in addition an exception list. The latter is retained to avoid the derived changes, and the exception list in the structure is initialized to an empty list when the recurrent instance is created. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/ui-day.c')
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ui-day.c b/src/ui-day.c
index 7d571fc..cb038d1 100644
--- a/src/ui-day.c
+++ b/src/ui-day.c
@@ -975,16 +975,20 @@ void ui_day_item_repeat(void)
/* Set the selected APP item. */
struct day_item d = empty_day;
+ struct rpt rpt;
+ rpt.type = type;
+ rpt.freq = freq;
+ rpt.until = until;
+ LLIST_INIT(&rpt.exc);
if (p->type == EVNT) {
struct event *ev = p->item.ev;
d.item.rev = recur_event_new(ev->mesg, ev->note, ev->day,
- ev->id, type, freq, until, NULL);
+ ev->id, &rpt);
} else if (p->type == APPT) {
struct apoint *apt = p->item.apt;
d.item.rapt = ra = recur_apoint_new(apt->mesg, apt->note,
apt->start, apt->dur,
- apt->state, type, freq,
- until, NULL);
+ apt->state, &rpt);
if (notify_bar())
} else {