summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/apoint.c16
-rw-r--r--src/calcurse.h11
-rw-r--r--src/event.c16
-rw-r--r--src/io.c6
-rw-r--r--src/note.c12
-rw-r--r--src/recur.c30
-rw-r--r--src/todo.c12
-rw-r--r--src/utils.c8
8 files changed, 47 insertions, 64 deletions
diff --git a/src/apoint.c b/src/apoint.c
index 6fd9e64..a49b156 100644
--- a/src/apoint.c
+++ b/src/apoint.c
@@ -46,21 +46,21 @@ static struct apoint bkp_cut_apoint;
static int hilt;
void
-apoint_free_bkp (enum eraseflg flag)
+apoint_free_bkp (void)
{
if (bkp_cut_apoint.mesg)
{
mem_free (bkp_cut_apoint.mesg);
bkp_cut_apoint.mesg = 0;
}
- erase_note (&bkp_cut_apoint.note, flag);
+ erase_note (&bkp_cut_apoint.note);
}
static void
apoint_free (struct apoint *apt)
{
mem_free (apt->mesg);
- erase_note (&apt->note, ERASE_FORCE_KEEP_NOTE);
+ erase_note (&apt->note);
mem_free (apt);
}
@@ -500,20 +500,18 @@ apoint_delete_bynum (long start, unsigned num, enum eraseflg flag)
switch (flag)
{
case ERASE_FORCE_ONLY_NOTE:
- erase_note (&apt->note, flag);
+ erase_note (&apt->note);
break;
case ERASE_CUT:
- apoint_free_bkp (ERASE_FORCE);
+ apoint_free_bkp ();
apoint_dup (apt, &bkp_cut_apoint);
- erase_note (&apt->note, ERASE_FORCE_KEEP_NOTE);
+ erase_note (&apt->note);
/* FALLTHROUGH */
default:
if (notify_bar ())
need_check_notify = notify_same_item (apt->start);
LLIST_TS_REMOVE (&alist_p, i);
mem_free (apt->mesg);
- if (flag != ERASE_FORCE_KEEP_NOTE && flag != ERASE_CUT)
- erase_note (&apt->note, flag);
mem_free (apt);
if (need_check_notify)
notify_check_next_app (0);
@@ -733,5 +731,5 @@ apoint_paste_item (void)
if (notify_bar ())
notify_check_added (bkp_cut_apoint.mesg, bkp_start, bkp_cut_apoint.state);
- apoint_free_bkp (ERASE_FORCE_KEEP_NOTE);
+ apoint_free_bkp ();
}
diff --git a/src/calcurse.h b/src/calcurse.h
index 4f0dc20..adf9d2d 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -484,7 +484,6 @@ enum item_type {
enum eraseflg {
ERASE_DONT_FORCE,
ERASE_FORCE,
- ERASE_FORCE_KEEP_NOTE,
ERASE_FORCE_ONLY_NOTE,
ERASE_CUT
};
@@ -554,7 +553,7 @@ enum save_display {
/* apoint.c */
extern llist_ts_t alist_p;
-void apoint_free_bkp (enum eraseflg);
+void apoint_free_bkp (void);
void apoint_llist_init (void);
void apoint_llist_free (void);
void apoint_hilt_set (int);
@@ -645,7 +644,7 @@ void dmon_stop (void);
/* event.c */
extern llist_t eventlist;
-void event_free_bkp (enum eraseflg);
+void event_free_bkp (void);
void event_llist_init (void);
void event_llist_free (void);
struct event *event_new (char *, char *, long, int);
@@ -753,7 +752,7 @@ void mem_stats (void);
/* note.c */
void edit_note (char **, char *);
void view_note (char *, char *);
-void erase_note (char **, enum eraseflg);
+void erase_note (char **);
void note_read (char *, FILE *);
/* notify.c */
@@ -782,8 +781,8 @@ void notify_config_bar (void);
/* recur.c */
extern llist_ts_t recur_alist_p;
extern llist_t recur_elist;
-void recur_event_free_bkp (enum eraseflg);
-void recur_apoint_free_bkp (enum eraseflg);
+void recur_event_free_bkp (void);
+void recur_apoint_free_bkp (void);
void recur_apoint_llist_init (void);
void recur_apoint_llist_free (void);
void recur_event_llist_free (void);
diff --git a/src/event.c b/src/event.c
index c395ed8..6c7e70f 100644
--- a/src/event.c
+++ b/src/event.c
@@ -45,21 +45,21 @@ llist_t eventlist;
static struct event bkp_cut_event;
void
-event_free_bkp (enum eraseflg flag)
+event_free_bkp (void)
{
if (bkp_cut_event.mesg)
{
mem_free (bkp_cut_event.mesg);
bkp_cut_event.mesg = 0;
}
- erase_note (&bkp_cut_event.note, flag);
+ erase_note (&bkp_cut_event.note);
}
static void
event_free (struct event *ev)
{
mem_free (ev->mesg);
- erase_note (&ev->note, ERASE_FORCE_KEEP_NOTE);
+ erase_note (&ev->note);
mem_free (ev);
}
@@ -194,18 +194,16 @@ event_delete_bynum (long start, unsigned num, enum eraseflg flag)
switch (flag)
{
case ERASE_FORCE_ONLY_NOTE:
- erase_note (&ev->note, flag);
+ erase_note (&ev->note);
break;
case ERASE_CUT:
- event_free_bkp (ERASE_FORCE);
+ event_free_bkp ();
event_dup (ev, &bkp_cut_event);
- erase_note (&ev->note, ERASE_FORCE_KEEP_NOTE);
+ erase_note (&ev->note);
/* FALLTHROUGH */
default:
LLIST_REMOVE (&eventlist, i);
mem_free (ev->mesg);
- if (flag != ERASE_FORCE_KEEP_NOTE && flag != ERASE_CUT)
- erase_note (&ev->note, flag);
mem_free (ev);
break;
}
@@ -217,5 +215,5 @@ event_paste_item (void)
(void)event_new (bkp_cut_event.mesg, bkp_cut_event.note,
date2sec (*calendar_get_slctd_day (), 12, 0),
bkp_cut_event.id);
- event_free_bkp (ERASE_FORCE_KEEP_NOTE);
+ event_free_bkp ();
}
diff --git a/src/io.c b/src/io.c
index 20dab48..c71934a 100644
--- a/src/io.c
+++ b/src/io.c
@@ -1749,7 +1749,7 @@ ical_store_todo (int priority, char *mesg, char *note)
{
todo_add (mesg, priority, note);
mem_free (mesg);
- erase_note (&note, ERASE_FORCE_KEEP_NOTE);
+ erase_note (&note);
}
static void
@@ -1781,7 +1781,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);
- erase_note (&note, ERASE_FORCE_KEEP_NOTE);
+ erase_note (&note);
}
static void
@@ -1803,7 +1803,7 @@ ical_store_apoint (char *mesg, char *note, long start, long dur,
apoint_new (mesg, note, start, dur, state);
}
mem_free (mesg);
- erase_note (&note, ERASE_FORCE_KEEP_NOTE);
+ erase_note (&note);
}
/*
diff --git a/src/note.c b/src/note.c
index 36c2c0f..db5c45a 100644
--- a/src/note.c
+++ b/src/note.c
@@ -65,7 +65,7 @@ edit_note (char **note, char *editor)
wins_launch_external (tmppath, editor);
if (io_file_is_empty (tmppath) > 0)
- erase_note (note, ERASE_FORCE_KEEP_NOTE);
+ erase_note (note);
else if ((fp = fopen (tmppath, "r")))
{
sha1_stream (fp, sha1);
@@ -93,18 +93,10 @@ view_note (char *note, char *pager)
/* Erase a note previously attached to an item. */
void
-erase_note (char **note, enum eraseflg flag)
+erase_note (char **note)
{
- char fullname[BUFSIZ];
-
if (*note == NULL)
return;
- if (flag != ERASE_FORCE_KEEP_NOTE)
- {
- (void)snprintf (fullname, BUFSIZ, "%s%s", path_notes, *note);
- if (unlink (fullname) != 0)
- EXIT (_("could not remove note"));
- }
mem_free (*note);
*note = NULL;
}
diff --git a/src/recur.c b/src/recur.c
index dbc52ee..0415257 100644
--- a/src/recur.c
+++ b/src/recur.c
@@ -93,7 +93,7 @@ exc_dup (llist_t *in, llist_t *exc)
}
void
-recur_event_free_bkp (enum eraseflg flag)
+recur_event_free_bkp (void)
{
if (bkp_cut_recur_event.mesg)
{
@@ -106,11 +106,11 @@ recur_event_free_bkp (enum eraseflg flag)
bkp_cut_recur_event.rpt = 0;
}
free_exc_list (&bkp_cut_recur_event.exc);
- erase_note (&bkp_cut_recur_event.note, flag);
+ erase_note (&bkp_cut_recur_event.note);
}
void
-recur_apoint_free_bkp (enum eraseflg flag)
+recur_apoint_free_bkp (void)
{
if (bkp_cut_recur_apoint.mesg)
{
@@ -123,7 +123,7 @@ recur_apoint_free_bkp (enum eraseflg flag)
bkp_cut_recur_apoint.rpt = 0;
}
free_exc_list (&bkp_cut_recur_apoint.exc);
- erase_note (&bkp_cut_recur_apoint.note, flag);
+ erase_note (&bkp_cut_recur_apoint.note);
}
static void
@@ -740,12 +740,12 @@ recur_event_erase (long start, unsigned num, unsigned delete_whole,
switch (flag)
{
case ERASE_FORCE_ONLY_NOTE:
- erase_note (&rev->note, flag);
+ erase_note (&rev->note);
break;
case ERASE_CUT:
- recur_event_free_bkp (ERASE_FORCE);
+ recur_event_free_bkp ();
recur_event_dup (rev, &bkp_cut_recur_event);
- erase_note (&rev->note, ERASE_FORCE_KEEP_NOTE);
+ erase_note (&rev->note);
/* FALLTHROUGH */
default:
LLIST_REMOVE (&recur_elist, i);
@@ -756,8 +756,6 @@ recur_event_erase (long start, unsigned num, unsigned delete_whole,
rev->rpt = 0;
}
free_exc_list (&rev->exc);
- if (flag != ERASE_FORCE_KEEP_NOTE && flag != ERASE_CUT)
- erase_note (&rev->note, flag);
mem_free (rev);
break;
}
@@ -791,12 +789,12 @@ recur_apoint_erase (long start, unsigned num, unsigned delete_whole,
switch (flag)
{
case ERASE_FORCE_ONLY_NOTE:
- erase_note (&rapt->note, flag);
+ erase_note (&rapt->note);
break;
case ERASE_CUT:
- recur_apoint_free_bkp (ERASE_FORCE);
+ recur_apoint_free_bkp ();
recur_apoint_dup (rapt, &bkp_cut_recur_apoint);
- erase_note (&rapt->note, ERASE_FORCE_KEEP_NOTE);
+ erase_note (&rapt->note);
/* FALLTHROUGH */
default:
LLIST_TS_REMOVE (&recur_alist_p, i);
@@ -807,8 +805,6 @@ recur_apoint_erase (long start, unsigned num, unsigned delete_whole,
rapt->rpt = 0;
}
free_exc_list (&rapt->exc);
- if (flag != ERASE_FORCE_KEEP_NOTE && flag != ERASE_CUT)
- erase_note (&rapt->note, flag);
mem_free (rapt);
if (need_check_notify)
notify_check_next_app (0);
@@ -970,7 +966,7 @@ recur_repeat_item (struct conf *conf)
EXIT (_("wrong item type"));
/* NOTREACHED */
}
- day_erase_item (date, item_nb, ERASE_FORCE_KEEP_NOTE);
+ day_erase_item (date, item_nb, ERASE_FORCE);
}
/*
@@ -1111,7 +1107,7 @@ recur_event_paste_item (void)
bkp_cut_recur_event.rpt->freq,
bkp_cut_recur_event.rpt->until,
&bkp_cut_recur_event.exc);
- recur_event_free_bkp (ERASE_FORCE_KEEP_NOTE);
+ recur_event_free_bkp ();
}
void
@@ -1145,5 +1141,5 @@ recur_apoint_paste_item (void)
if (notify_bar ())
notify_check_repeated (&bkp_cut_recur_apoint);
- recur_apoint_free_bkp (ERASE_FORCE_KEEP_NOTE);
+ recur_apoint_free_bkp ();
}
diff --git a/src/todo.c b/src/todo.c
index 3c0d1ba..1ccd9f1 100644
--- a/src/todo.c
+++ b/src/todo.c
@@ -204,12 +204,12 @@ todo_delete_note_bynum (unsigned num)
if (!todo->note)
EXIT (_("no note attached"));
- erase_note (&todo->note, ERASE_FORCE_ONLY_NOTE);
+ erase_note (&todo->note);
}
/* Delete an item from the todo linked list. */
static void
-todo_delete_bynum (unsigned num, enum eraseflg flag)
+todo_delete_bynum (unsigned num)
{
llist_item_t *i = LLIST_NTH (&todolist, num);
@@ -219,7 +219,7 @@ todo_delete_bynum (unsigned num, enum eraseflg flag)
LLIST_REMOVE (&todolist, i);
mem_free (todo->mesg);
- erase_note (&todo->note, flag);
+ erase_note (&todo->note);
mem_free (todo);
}
@@ -288,7 +288,7 @@ todo_delete (struct conf *conf)
switch (answer)
{
case 't':
- todo_delete_bynum (hilt - 1, ERASE_FORCE);
+ todo_delete_bynum (hilt - 1);
todos--;
if (hilt > 1)
hilt--;
@@ -358,7 +358,7 @@ todo_chg_priority (int action)
}
if (do_chg)
{
- todo_delete_bynum (hilt - 1, ERASE_FORCE_KEEP_NOTE);
+ todo_delete_bynum (hilt - 1);
backup = todo_add (backup_mesg, backup_id, backup_note);
hilt = todo_get_position (backup);
}
@@ -516,7 +516,7 @@ void
todo_free (struct todo *todo)
{
mem_free (todo->mesg);
- erase_note (&todo->note, ERASE_FORCE_KEEP_NOTE);
+ erase_note (&todo->note);
mem_free (todo);
}
diff --git a/src/utils.c b/src/utils.c
index 4ea2ce3..ac7706c 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -89,13 +89,13 @@ free_user_data (void)
{
day_free_list ();
event_llist_free ();
- event_free_bkp (ERASE_FORCE);
+ event_free_bkp ();
apoint_llist_free ();
- apoint_free_bkp (ERASE_FORCE);
+ apoint_free_bkp ();
recur_apoint_llist_free ();
recur_event_llist_free ();
- recur_apoint_free_bkp (ERASE_FORCE);
- recur_event_free_bkp (ERASE_FORCE);
+ recur_apoint_free_bkp ();
+ recur_event_free_bkp ();
todo_free_list ();
notify_free_app ();
}