From 02c90ba53a658686bad5cb5f88c555d9eef06399 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 26 Jun 2012 13:29:54 +0200 Subject: 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 --- src/todo.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/todo.c') 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); } -- cgit v1.2.3