summaryrefslogtreecommitdiff
path: root/src/recur.c
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2009-07-19 08:19:37 +0000
committerFrederic Culot <calcurse@culot.org>2009-07-19 08:19:37 +0000
commit5dcc213c164a1f25cad4bd76617dc780f5e1dc6f (patch)
tree655127ff74d3a72bacf6bde1a4cb0f7f9733c9fc /src/recur.c
parenta4da35c65f77113f998cd60d8a1a10d108138951 (diff)
downloadcalcurse-5dcc213c164a1f25cad4bd76617dc780f5e1dc6f.zip
Make use of erase_note() whenever possible.
Diffstat (limited to 'src/recur.c')
-rwxr-xr-xsrc/recur.c56
1 files changed, 25 insertions, 31 deletions
diff --git a/src/recur.c b/src/recur.c
index ee35d41..e21bf0c 100755
--- a/src/recur.c
+++ b/src/recur.c
@@ -1,4 +1,4 @@
-/* $calcurse: recur.c,v 1.51 2009/07/05 20:33:23 culot Exp $ */
+/* $calcurse: recur.c,v 1.52 2009/07/19 08:20:01 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -116,16 +116,7 @@ recur_event_free_bkp (erase_flag_e flag)
free_exc (bkp_cut_recur_event.exc);
bkp_cut_recur_event.exc = 0;
}
- if (bkp_cut_recur_event.note)
- {
- if (flag == ERASE_FORCE)
- erase_note (&bkp_cut_recur_event.note, ERASE_FORCE);
- else
- {
- mem_free (bkp_cut_recur_event.note);
- bkp_cut_recur_event.note = 0;
- }
- }
+ erase_note (&bkp_cut_recur_event.note, flag);
}
void
@@ -146,16 +137,7 @@ recur_apoint_free_bkp (erase_flag_e flag)
free_exc (bkp_cut_recur_apoint.exc);
bkp_cut_recur_apoint.exc = 0;
}
- if (bkp_cut_recur_apoint.note)
- {
- if (flag == ERASE_FORCE)
- erase_note (&bkp_cut_recur_apoint.note, ERASE_FORCE);
- else
- {
- mem_free (bkp_cut_recur_apoint.note);
- bkp_cut_recur_apoint.note = 0;
- }
- }
+ erase_note (&bkp_cut_recur_apoint.note, flag);
}
static void
@@ -720,15 +702,21 @@ recur_event_erase (long start, unsigned num, unsigned delete_whole,
case ERASE_CUT:
recur_event_free_bkp (ERASE_FORCE);
recur_event_dup (i, &bkp_cut_recur_event);
- if (i->note)
- mem_free (i->note);
+ erase_note (&i->note, ERASE_FORCE_KEEP_NOTE);
/* FALLTHROUGH */
default:
*iptr = i->next;
mem_free (i->mesg);
- mem_free (i->rpt);
- free_exc (i->exc);
- i->exc = 0;
+ if (i->rpt)
+ {
+ mem_free (i->rpt);
+ i->rpt = 0;
+ }
+ if (i->exc)
+ {
+ free_exc (i->exc);
+ i->exc = 0;
+ }
if (flag != ERASE_FORCE_KEEP_NOTE && flag != ERASE_CUT)
erase_note (&i->note, flag);
mem_free (i);
@@ -783,15 +771,21 @@ recur_apoint_erase (long start, unsigned num, unsigned delete_whole,
case ERASE_CUT:
recur_apoint_free_bkp (ERASE_FORCE);
recur_apoint_dup (i, &bkp_cut_recur_apoint);
- if (i->note)
- mem_free (i->note);
+ erase_note (&i->note, ERASE_FORCE_KEEP_NOTE);
/* FALLTHROUGH */
default:
*iptr = i->next;
mem_free (i->mesg);
- mem_free (i->rpt);
- free_exc (i->exc);
- i->exc = 0;
+ if (i->rpt)
+ {
+ mem_free (i->rpt);
+ i->rpt = 0;
+ }
+ if (i->exc)
+ {
+ free_exc (i->exc);
+ i->exc = 0;
+ }
if (flag != ERASE_FORCE_KEEP_NOTE && flag != ERASE_CUT)
erase_note (&i->note, flag);
mem_free (i);