diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-07-07 18:10:12 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-07-07 21:36:38 +0200 |
commit | 88588ad704329939834b45eb2058fb48f0a5068f (patch) | |
tree | 37156cf05dd7ce803d381089cbca977135790b7d /src/day.c | |
parent | 7fb25a84d427f4a3cb79ea02908daf9ce8ba07ca (diff) | |
download | calcurse-88588ad704329939834b45eb2058fb48f0a5068f.zip |
Refactor exception handling
Remove the exception handling code from recur_*_erase() and move it to
separate functions recur_*_add_exc(). Create a wrapper function
day_item_add_exc() that can be used to add an exception to generic
items.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/day.c')
-rw-r--r-- | src/day.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -168,6 +168,17 @@ int day_item_get_state(struct day_item *day) } } +/* Add an exception to an item. */ +void day_item_add_exc(struct day_item *day, long date) +{ + switch (day->type) { + case RECUR_EVNT: + recur_event_add_exc(day->item.rev, date); + case RECUR_APPT: + recur_apoint_add_exc(day->item.rapt, date); + } +} + /* Clone the actual item. */ void day_item_fork(struct day_item *day_in, struct day_item *day_out) { @@ -648,13 +659,13 @@ struct day_item *day_cut_item(long date, int item_number) event_delete(p->item.ev, ERASE_CUT); break; case RECUR_EVNT: - recur_event_erase(p->item.rev, date, 1, ERASE_CUT); + recur_event_erase(p->item.rev, ERASE_CUT); break; case APPT: apoint_delete(p->item.apt, ERASE_CUT); break; case RECUR_APPT: - recur_apoint_erase(p->item.rapt, date, 1, ERASE_CUT); + recur_apoint_erase(p->item.rapt, ERASE_CUT); break; default: EXIT(_("unknwon type")); |