summaryrefslogtreecommitdiff
path: root/src/recur.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-07-07 19:22:49 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-07-07 21:40:56 +0200
commit0f20693b07cb67c64d125cc1b07522826e4f8e00 (patch)
tree318e55e4021c3c57d1753d7665241e4f6e2fb7f2 /src/recur.c
parent13c21ac28023542a10cb75c085ce1925da2cdd0e (diff)
downloadcalcurse-0f20693b07cb67c64d125cc1b07522826e4f8e00.zip
Remove the erase flag and legacy deletion code
This is no longer needed. Note removal, as well as exception handling, have been moved to separate functions and the cut feature has been merged into the deletion function. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/recur.c')
-rw-r--r--src/recur.c44
1 files changed, 9 insertions, 35 deletions
diff --git a/src/recur.c b/src/recur.c
index 335cbf6..3338017 100644
--- a/src/recur.c
+++ b/src/recur.c
@@ -697,28 +697,14 @@ recur_apoint_add_exc(struct recur_apoint *rapt, long date)
* or delete only one occurence of the recurrent event.
*/
void
-recur_event_erase(struct recur_event *rev, enum eraseflg flag)
+recur_event_erase(struct recur_event *rev)
{
llist_item_t *i = LLIST_FIND_FIRST(&recur_elist, rev, NULL);
if (!i)
EXIT(_("event not found"));
- switch (flag) {
- case ERASE_CUT:
- LLIST_REMOVE(&recur_elist, i);
- return;
- default:
- LLIST_REMOVE(&recur_elist, i);
- mem_free(rev->mesg);
- if (rev->rpt) {
- mem_free(rev->rpt);
- rev->rpt = 0;
- }
- free_exc_list(&rev->exc);
- mem_free(rev);
- break;
- }
+ LLIST_REMOVE(&recur_elist, i);
}
/*
@@ -726,34 +712,22 @@ recur_event_erase(struct recur_event *rev, enum eraseflg flag)
* or delete only one occurence of the recurrent appointment.
*/
void
-recur_apoint_erase(struct recur_apoint *rapt, enum eraseflg flag)
+recur_apoint_erase(struct recur_apoint *rapt)
{
+ LLIST_TS_LOCK(&recur_alist_p);
+
llist_item_t *i = LLIST_TS_FIND_FIRST(&recur_alist_p, rapt, NULL);
int need_check_notify = 0;
if (!i)
EXIT(_("appointment not found"));
- LLIST_TS_LOCK(&recur_alist_p);
if (notify_bar())
need_check_notify = notify_same_recur_item(rapt);
- switch (flag) {
- case ERASE_CUT:
- LLIST_TS_REMOVE(&recur_alist_p, i);
- break;
- default:
- LLIST_TS_REMOVE(&recur_alist_p, i);
- mem_free(rapt->mesg);
- if (rapt->rpt) {
- mem_free(rapt->rpt);
- rapt->rpt = 0;
- }
- free_exc_list(&rapt->exc);
- mem_free(rapt);
- if (need_check_notify)
- notify_check_next_app(0);
- break;
- }
+ LLIST_TS_REMOVE(&recur_alist_p, i);
+ if (need_check_notify)
+ notify_check_next_app(0);
+
LLIST_TS_UNLOCK(&recur_alist_p);
}