aboutsummaryrefslogtreecommitdiffstats
path: root/src/todo.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-06-26 13:29:54 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-06-30 14:34:35 +0200
commit02c90ba53a658686bad5cb5f88c555d9eef06399 (patch)
tree4c9676d9e1bb703bb757cd05c6ce273e073e5c0e /src/todo.c
parente1fbee0071ad6bb5d5c17865c5a7b67a63930e7d (diff)
downloadcalcurse-02c90ba53a658686bad5cb5f88c555d9eef06399.tar.gz
calcurse-02c90ba53a658686bad5cb5f88c555d9eef06399.zip
Revise *_delete{,_bynum}()
Always pass an item instead of passing a date and a index. This makes use of the NULL callback that was added with one of the previous patches. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/todo.c')
-rw-r--r--src/todo.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/todo.c b/src/todo.c
index 053f9d6..2ca648d 100644
--- a/src/todo.c
+++ b/src/todo.c
@@ -170,13 +170,12 @@ void todo_delete_note_bynum(unsigned num)
}
/* Delete an item from the todo linked list. */
-void todo_delete_bynum(unsigned num)
+void todo_delete(struct todo *todo)
{
- llist_item_t *i = LLIST_NTH(&todolist, num);
+ llist_item_t *i = LLIST_FIND_FIRST(&todolist, todo, NULL);
if (!i)
EXIT(_("no such todo"));
- struct todo *todo = LLIST_TS_GET_DATA(i);
LLIST_REMOVE(&todolist, i);
mem_free(todo->mesg);
@@ -250,7 +249,7 @@ void todo_chg_priority(int action)
/* NOTREACHED */
}
- todo_delete_bynum(hilt - 1);
+ todo_delete(todo_get_item(hilt));
backup = todo_add(backup_mesg, backup_id, backup_note);
hilt = todo_get_position(backup);
}