From d7169ee7ffd45318125dbe3013aadbd1482a3e5f Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 29 Jun 2018 19:44:54 +1000 Subject: [PATCH] Replace list_empty with a simple alternative --- common/list.c | 7 ------- include/list.h | 1 - sway/desktop/transaction.c | 2 +- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/common/list.c b/common/list.c index cab10c1e..39cc10e1 100644 --- a/common/list.c +++ b/common/list.c @@ -62,13 +62,6 @@ void list_cat(list_t *list, list_t *source) { } } -void list_empty(list_t *list) { - list->capacity = 10; - list->length = 0; - free(list->items); - list->items = malloc(sizeof(void*) * list->capacity); -} - void list_qsort(list_t *list, int compare(const void *left, const void *right)) { qsort(list->items, list->length, sizeof(void *), compare); } diff --git a/include/list.h b/include/list.h index d352dbd5..7eead4ac 100644 --- a/include/list.h +++ b/include/list.h @@ -14,7 +14,6 @@ void list_add(list_t *list, void *item); void list_insert(list_t *list, int index, void *item); void list_del(list_t *list, int index); void list_cat(list_t *list, list_t *source); -void list_empty(list_t *list); // See qsort. Remember to use *_qsort functions as compare functions, // because they dereference the left and right arguments first! void list_qsort(list_t *list, int compare(const void *left, const void *right)); diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 7a2e78e5..fc23ef35 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -241,7 +241,7 @@ static void transaction_progress_queue() { transaction_apply(transaction); transaction_destroy(transaction); } - list_empty(server.transactions); + server.transactions->length = 0; } static int handle_timeout(void *data) {