Todo resort() optimization

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lars Henriksen 2021-01-20 23:47:42 +01:00 committed by Lukas Fleischer
parent b44307cc83
commit 4777c60056

View File

@ -158,9 +158,7 @@ void todo_delete(struct todo *todo)
*/ */
void todo_resort(struct todo *t) void todo_resort(struct todo *t)
{ {
llist_item_t *i = LLIST_FIND_FIRST(&todolist, t, NULL); LLIST_REORDER(&todolist, t, todo_cmp);
LLIST_REMOVE(&todolist, i);
LLIST_ADD_SORTED(&todolist, t, todo_cmp);
} }
/* Flag a todo item. */ /* Flag a todo item. */