From 4777c60056e42d985cff4e48beb06cdb4cd9b83f Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Wed, 20 Jan 2021 23:47:42 +0100 Subject: Todo resort() optimization Signed-off-by: Lukas Fleischer --- src/todo.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/todo.c b/src/todo.c index aa77b15..932e02a 100644 --- a/src/todo.c +++ b/src/todo.c @@ -158,9 +158,7 @@ void todo_delete(struct todo *todo) */ void todo_resort(struct todo *t) { - llist_item_t *i = LLIST_FIND_FIRST(&todolist, t, NULL); - LLIST_REMOVE(&todolist, i); - LLIST_ADD_SORTED(&todolist, t, todo_cmp); + LLIST_REORDER(&todolist, t, todo_cmp); } /* Flag a todo item. */ -- cgit v1.2.3-70-g09d2