summaryrefslogtreecommitdiff
path: root/src/io.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/io.c
parenta4da35c65f77113f998cd60d8a1a10d108138951 (diff)
downloadcalcurse-5dcc213c164a1f25cad4bd76617dc780f5e1dc6f.zip
Make use of erase_note() whenever possible.
Diffstat (limited to 'src/io.c')
-rwxr-xr-xsrc/io.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/io.c b/src/io.c
index 582d91e..8d51e81 100755
--- a/src/io.c
+++ b/src/io.c
@@ -1,4 +1,4 @@
-/* $calcurse: io.c,v 1.69 2009/07/15 18:48:44 culot Exp $ */
+/* $calcurse: io.c,v 1.70 2009/07/19 08:20:00 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -1666,8 +1666,7 @@ ical_store_todo (int priority, char *mesg, char *note)
{
todo_add (mesg, priority, note);
mem_free (mesg);
- if (note)
- mem_free (note);
+ erase_note (&note, ERASE_FORCE_KEEP_NOTE);
}
static void
@@ -1699,7 +1698,7 @@ ical_store_event (char *mesg, char *note, long day, long end, ical_rpt_t *rpt,
event_new (mesg, note, day, EVENTID);
}
mem_free (mesg);
- mem_free (note);
+ erase_note (&note, ERASE_FORCE_KEEP_NOTE);
}
static void
@@ -1710,7 +1709,7 @@ ical_store_apoint (char *mesg, char *note, long start, long dur,
if (has_alarm)
state |= APOINT_NOTIFY;
- if (rpt != NULL)
+ if (rpt)
{
recur_apoint_new (mesg, note, start, dur, state, rpt->type, rpt->freq,
rpt->until, &exc);
@@ -1721,8 +1720,7 @@ ical_store_apoint (char *mesg, char *note, long start, long dur,
apoint_new (mesg, note, start, dur, state);
}
mem_free (mesg);
- if (note)
- mem_free (note);
+ erase_note (&note, ERASE_FORCE_KEEP_NOTE);
}
/*
@@ -2524,11 +2522,15 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints,
"The end of item was not found."));
cleanup:
-
- mem_free (vevent.note);
- mem_free (vevent.mesg);
- mem_free (vevent.rpt);
- mem_free (vevent.exc);
+
+ if (vevent.note)
+ mem_free (vevent.note);
+ if (vevent.mesg)
+ mem_free (vevent.mesg);
+ if (vevent.rpt)
+ mem_free (vevent.rpt);
+ if (vevent.exc)
+ mem_free (vevent.exc);
(*noskipped)++;
}
@@ -2621,9 +2623,11 @@ ical_read_todo (FILE *fdi, FILE *log, unsigned *notodos, unsigned *noskipped,
"The end of item was not found."));
cleanup:
-
- mem_free (vtodo.note);
- mem_free (vtodo.mesg);
+
+ if (vtodo.note)
+ mem_free (vtodo.note);
+ if (vtodo.mesg)
+ mem_free (vtodo.mesg);
(*noskipped)++;
}