summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2009-01-02 19:52:32 +0000
committerFrederic Culot <calcurse@culot.org>2009-01-02 19:52:32 +0000
commitaa7d6c5eb75d236a6a58b4df8c98335fd0ac24dd (patch)
tree99f53002ba1c7d7f828761974d5b8f681ee867e2
parentcac30a7e1469a8f061f64712dbea100a012dd788 (diff)
downloadcalcurse-aa7d6c5eb75d236a6a58b4df8c98335fd0ac24dd.zip
various bugfixes
-rwxr-xr-xChangeLog7
-rwxr-xr-xsrc/apoint.c6
-rwxr-xr-xsrc/day.c6
-rwxr-xr-xsrc/event.c6
-rwxr-xr-xsrc/io.c5
-rwxr-xr-xsrc/keys.c6
-rw-r--r--src/mem.c5
-rwxr-xr-xsrc/recur.c37
-rwxr-xr-xsrc/todo.c6
9 files changed, 46 insertions, 38 deletions
diff --git a/ChangeLog b/ChangeLog
index 47e9e76..675ccb7 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-02 Frederic Culot <frederic@culot.org>
+
+ * src/io.c (io_stop_pthread_save): do not crash when canceling the
+ thread if it was not started before
+
2009-01-01 Frederic Culot <frederic@culot.org>
* src/event.c (event_free_bkp, event_llist_free): new functions
@@ -16,7 +21,7 @@
that made repeated items with exceptions load uncorrectly in
some cases (thanks Jan for reporting it)
- * NEWS: updated (it is now possible to move an item from one date
+ * TODO: updated (it is now possible to move an item from one date
to another by using the cut/paste feature)
2008-12-30 Frederic Culot <frederic@culot.org>
diff --git a/src/apoint.c b/src/apoint.c
index 31bac44..eee97de 100755
--- a/src/apoint.c
+++ b/src/apoint.c
@@ -1,4 +1,4 @@
-/* $calcurse: apoint.c,v 1.30 2009/01/01 17:50:41 culot Exp $ */
+/* $calcurse: apoint.c,v 1.31 2009/01/02 19:52:32 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -92,14 +92,14 @@ apoint_llist_free (void)
apoint_llist_node_t *o, **i;
i = &alist_p->root;
- for (o = alist_p->root; o; o = o->next)
+ while (*i)
{
+ o = *i;
*i = o->next;
mem_free (o->mesg);
if (o->note)
mem_free (o->note);
mem_free (o);
- i = &(*i)->next;
}
mem_free (alist_p);
}
diff --git a/src/day.c b/src/day.c
index 8de0a94..6df66e4 100755
--- a/src/day.c
+++ b/src/day.c
@@ -1,4 +1,4 @@
-/* $calcurse: day.c,v 1.45 2009/01/01 17:50:41 culot Exp $ */
+/* $calcurse: day.c,v 1.46 2009/01/02 19:52:32 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -62,14 +62,14 @@ day_free_list (void)
struct day_item_s *o, **i;
i = &day_items_ptr;
- for (o = day_items_ptr; o; o = o->next)
+ while (*i)
{
+ o = *i;
*i = o->next;
mem_free (o->mesg);
if (o->note)
mem_free (o->note);
mem_free (o);
- i = &(*i)->next;
}
day_items_ptr = NULL;
}
diff --git a/src/event.c b/src/event.c
index 7bc6aeb..7c86138 100755
--- a/src/event.c
+++ b/src/event.c
@@ -1,4 +1,4 @@
-/* $calcurse: event.c,v 1.10 2009/01/01 17:50:41 culot Exp $ */
+/* $calcurse: event.c,v 1.11 2009/01/02 19:52:32 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -70,14 +70,14 @@ event_llist_free (void)
struct event_s *o, **i;
i = &eventlist;
- for (o = eventlist; o; o = o->next)
+ while (*i)
{
+ o = *i;
*i = o->next;
mem_free (o->mesg);
if (o->note)
mem_free (o->note);
mem_free (o);
- i = &(*i)->next;
}
}
diff --git a/src/io.c b/src/io.c
index a2da17b..86503e7 100755
--- a/src/io.c
+++ b/src/io.c
@@ -1,4 +1,4 @@
-/* $calcurse: io.c,v 1.52 2009/01/01 17:50:41 culot Exp $ */
+/* $calcurse: io.c,v 1.53 2009/01/02 19:52:32 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -2812,5 +2812,6 @@ io_start_psave_thread (conf_t *conf)
void
io_stop_psave_thread (void)
{
- pthread_cancel (io_t_psave);
+ if (io_t_psave)
+ pthread_cancel (io_t_psave);
}
diff --git a/src/keys.c b/src/keys.c
index ecfeb38..96fd19f 100755
--- a/src/keys.c
+++ b/src/keys.c
@@ -1,4 +1,4 @@
-/* $calcurse: keys.c,v 1.12 2009/01/01 17:50:41 culot Exp $ */
+/* $calcurse: keys.c,v 1.13 2009/01/02 19:52:32 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -141,12 +141,12 @@ keys_free (void)
continue;
i = &keys[key];
- for (o = keys[key]; o; o = o->next)
+ while (*i)
{
+ o = *i;
*i = o->next;
mem_free (o->str);
mem_free (o);
- i = &o->next;
}
}
}
diff --git a/src/mem.c b/src/mem.c
index 4b1a467..503cd13 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -1,8 +1,8 @@
-/* $calcurse: mem.c,v 1.1 2008/12/28 13:15:18 culot Exp $ */
+/* $calcurse: mem.c,v 1.2 2009/01/02 19:52:32 culot Exp $ */
/*
* Calcurse - text-based organizer
- * Copyright (c) 2008 Frederic Culot
+ * Copyright (c) 2008-2009 Frederic Culot
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,6 +26,7 @@
#include <string.h>
#include <stdio.h>
+#include <stdint.h>
#include "i18n.h"
#include "utils.h"
diff --git a/src/recur.c b/src/recur.c
index b3cfc77..b24d557 100755
--- a/src/recur.c
+++ b/src/recur.c
@@ -1,4 +1,4 @@
-/* $calcurse: recur.c,v 1.47 2009/01/01 17:50:41 culot Exp $ */
+/* $calcurse: recur.c,v 1.48 2009/01/02 19:52:32 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -44,18 +44,17 @@ static struct recur_event_s bkp_cut_recur_event;
static recur_apoint_llist_node_t bkp_cut_recur_apoint;
static void
-free_exc (struct days_s **exc)
+free_exc (struct days_s *exc)
{
struct days_s *o, **i;
- i = exc;
- for (o = *exc; o; o = o->next)
+ i = &exc;
+ while (*i)
{
+ o = *i;
*i = o->next;
mem_free (o);
- i = &(*i)->next;
}
- *exc = 0;
}
static void
@@ -107,7 +106,7 @@ recur_event_free_bkp (void)
}
if (bkp_cut_recur_event.exc)
{
- free_exc (&bkp_cut_recur_event.exc);
+ free_exc (bkp_cut_recur_event.exc);
bkp_cut_recur_event.exc = 0;
}
}
@@ -132,7 +131,7 @@ recur_apoint_free_bkp (void)
}
if (bkp_cut_recur_apoint.exc)
{
- free_exc (&bkp_cut_recur_apoint.exc);
+ free_exc (bkp_cut_recur_apoint.exc);
bkp_cut_recur_apoint.exc = 0;
}
}
@@ -194,8 +193,9 @@ recur_apoint_llist_free (void)
recur_apoint_llist_node_t *o, **i;
i = &recur_alist_p->root;
- for (o = recur_alist_p->root; o; o = o->next)
+ while (*i)
{
+ o = *i;
*i = o->next;
mem_free (o->mesg);
if (o->note)
@@ -204,11 +204,10 @@ recur_apoint_llist_free (void)
mem_free (o->rpt);
if (o->exc)
{
- free_exc (&o->exc);
+ free_exc (o->exc);
o->exc = 0;
}
mem_free (o);
- i = &(*i)->next;
}
mem_free (recur_alist_p);
}
@@ -219,8 +218,9 @@ recur_event_llist_free (void)
struct recur_event_s *o, **i;
i = &recur_elist;
- for (o = recur_elist; o; o = o->next)
+ while (*i)
{
+ o = *i;
*i = o->next;
mem_free (o->mesg);
if (o->note)
@@ -229,11 +229,10 @@ recur_event_llist_free (void)
mem_free (o->rpt);
if (o->exc)
{
- free_exc (&o->exc);
+ free_exc (o->exc);
o->exc = 0;
}
mem_free (o);
- i = &(*i)->next;
}
}
@@ -258,7 +257,8 @@ recur_apoint_new (char *mesg, char *note, long start, long dur, char state,
if (except && *except)
{
exc_dup (&o->exc, *except);
- free_exc (except);
+ free_exc (*except);
+ *except = 0;
}
pthread_mutex_lock (&(recur_alist_p->mutex));
@@ -298,7 +298,8 @@ recur_event_new (char *mesg, char *note, long day, int id, int type, int freq,
if (except && *except)
{
exc_dup (&o->exc, *except);
- free_exc (except);
+ free_exc (*except);
+ *except = 0;
}
i = &recur_elist;
@@ -704,7 +705,7 @@ recur_event_erase (long start, unsigned num, unsigned delete_whole,
*iptr = i->next;
mem_free (i->mesg);
mem_free (i->rpt);
- free_exc (&i->exc);
+ free_exc (i->exc);
i->exc = 0;
if (flag != ERASE_FORCE_KEEP_NOTE && flag != ERASE_CUT)
erase_note (&i->note, flag);
@@ -767,7 +768,7 @@ recur_apoint_erase (long start, unsigned num, unsigned delete_whole,
*iptr = i->next;
mem_free (i->mesg);
mem_free (i->rpt);
- free_exc (&i->exc);
+ free_exc (i->exc);
i->exc = 0;
if (flag != ERASE_FORCE_KEEP_NOTE && flag != ERASE_CUT)
erase_note (&i->note, flag);
diff --git a/src/todo.c b/src/todo.c
index 68601f6..34bc8f2 100755
--- a/src/todo.c
+++ b/src/todo.c
@@ -1,4 +1,4 @@
-/* $calcurse: todo.c,v 1.29 2008/12/28 13:13:59 culot Exp $ */
+/* $calcurse: todo.c,v 1.30 2009/01/02 19:52:32 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -492,14 +492,14 @@ todo_free_list (void)
struct todo_s *o, **i;
i = &todolist;
- for (o = todolist; o != 0; o = o->next)
+ while (*i)
{
+ o = *i;
*i = o->next;
mem_free (o->mesg);
if (o->note != 0)
erase_note (&o->note, ERASE_FORCE_KEEP_NOTE);
mem_free (o);
- i = &(*i)->next;
}
if (todolist)
mem_free (todolist);