summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2009-07-27 19:35:09 +0000
committerFrederic Culot <calcurse@culot.org>2009-07-27 19:35:09 +0000
commitb45a8bfbb454160e8e4a2f4925a0c1ad27ef92c2 (patch)
tree1080969d4c05454a6cb13c1c2d3b82d0c6ed3bd4
parentf0005f64dc522a3cd2fd1f8083f70047b17d015a (diff)
downloadcalcurse-b45a8bfbb454160e8e4a2f4925a0c1ad27ef92c2.tar.gz
calcurse-b45a8bfbb454160e8e4a2f4925a0c1ad27ef92c2.zip
Work on allocating and freeing memory associated with user's data for the daemon.
-rwxr-xr-xChangeLog7
-rw-r--r--src/dmon.c7
-rwxr-xr-xsrc/utils.c30
-rwxr-xr-xsrc/utils.h3
4 files changed, 32 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 7eb2e2c..4d60b63 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-07-27 Frederic Culot <frederic@culot.org>
+
+ * src/utils.c (free_user_data): new function
+
+ * src/dmon.c: work on allocating and freeing memory associated
+ with user data
+
2009-07-26 Frederic Culot <frederic@culot.org>
* src/args.c (parse_args): check for file presence added (thanks
diff --git a/src/dmon.c b/src/dmon.c
index 8a2f66a..772b92f 100644
--- a/src/dmon.c
+++ b/src/dmon.c
@@ -1,4 +1,4 @@
-/* $calcurse: dmon.c,v 1.5 2009/07/26 21:03:21 culot Exp $ */
+/* $calcurse: dmon.c,v 1.6 2009/07/27 19:35:09 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -67,7 +67,8 @@
static void
dmon_sigs_hdlr (int sig)
{
- notify_free_app ();
+ free_user_data ();
+
DMON_LOG (_("terminated at %s with signal %d\n"), nowstr (), sig);
if (unlink (path_dpid) != 0)
@@ -164,6 +165,8 @@ dmon_start (int parent_exit_status)
custom_load_conf (&conf, 0);
io_check_file (path_apts, (int *)0);
+ apoint_llist_init ();
+ recur_apoint_llist_init ();
io_load_app ();
for (;;)
diff --git a/src/utils.c b/src/utils.c
index b4e7a93..37eab66 100755
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,4 +1,4 @@
-/* $calcurse: utils.c,v 1.80 2009/07/26 20:26:16 culot Exp $ */
+/* $calcurse: utils.c,v 1.81 2009/07/27 19:35:09 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -80,17 +80,7 @@ exit_calcurse (int status)
calendar_stop_date_thread ();
io_stop_psave_thread ();
- day_free_list ();
- event_llist_free ();
- event_free_bkp (ERASE_FORCE);
- apoint_llist_free ();
- apoint_free_bkp (ERASE_FORCE);
- recur_apoint_llist_free ();
- recur_event_llist_free ();
- recur_apoint_free_bkp (ERASE_FORCE);
- recur_event_free_bkp (ERASE_FORCE);
- todo_free_list ();
- notify_free_app ();
+ free_user_data ();
keys_free ();
mem_stats ();
if (was_interactive)
@@ -104,6 +94,22 @@ exit_calcurse (int status)
exit (status);
}
+void
+free_user_data (void)
+{
+ day_free_list ();
+ event_llist_free ();
+ event_free_bkp (ERASE_FORCE);
+ apoint_llist_free ();
+ apoint_free_bkp (ERASE_FORCE);
+ recur_apoint_llist_free ();
+ recur_event_llist_free ();
+ recur_apoint_free_bkp (ERASE_FORCE);
+ recur_event_free_bkp (ERASE_FORCE);
+ todo_free_list ();
+ notify_free_app ();
+}
+
/* Function to exit on internal error. */
void
fatalbox (const char *errmsg)
diff --git a/src/utils.h b/src/utils.h
index 035f29a..3f5e36f 100755
--- a/src/utils.h
+++ b/src/utils.h
@@ -1,4 +1,4 @@
-/* $calcurse: utils.h,v 1.48 2009/07/23 18:33:22 culot Exp $ */
+/* $calcurse: utils.h,v 1.49 2009/07/27 19:35:09 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -124,6 +124,7 @@ typedef enum
erase_flag_e;
void exit_calcurse (int);
+void free_user_data (void);
void fatalbox (const char *);
void warnbox (const char *);
void status_mesg (char *, char *);