mirror of
https://github.com/NickHu/sway
synced 2024-12-27 21:58:11 +01:00
Replace list_empty with a simple alternative
This commit is contained in:
parent
e8fb6b3325
commit
d7169ee7ff
3 changed files with 1 additions and 9 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue