diff options
Diffstat (limited to 'src/list.c')
-rw-r--r-- | src/list.c | 19 |
1 files changed, 6 insertions, 13 deletions
@@ -65,16 +65,14 @@ grecs_list_pop (struct grecs_list *lp) { void *data; struct grecs_list_entry *ep = lp->head; - if (ep) - { + if (ep) { data = ep->data; lp->head = ep->next; if (!lp->head) lp->tail = NULL; lp->count--; free (ep); - } - else + } else data = NULL; return data; } @@ -84,8 +82,7 @@ grecs_list_clear (struct grecs_list *lp) { struct grecs_list_entry *ep = lp->head; - while (ep) - { + while (ep) { struct grecs_list_entry *next = ep->next; if (lp->free_entry) lp->free_entry(ep->data); @@ -115,8 +112,7 @@ grecs_list_locate (struct grecs_list *lp, void *data) struct grecs_list_entry *ep; int (*cmp)(const void *, const void *) = lp->cmp ? lp->cmp : _ptrcmp; - for (ep = lp->head; ep; ep = ep->next) - { + for (ep = lp->head; ep; ep = ep->next) { if (cmp(ep->data, data) == 0) return ep->data; } @@ -141,14 +137,11 @@ grecs_list_remove_tail (struct grecs_list *lp) if (!lp->head) return NULL; data = lp->tail; - if (lp->head == lp->tail) - { + if (lp->head == lp->tail) { free(lp->tail); lp->head = lp->tail = NULL; lp->count = 0; - } - else - { + } else { struct grecs_list_entry *ep; for (ep = lp->head; ep->next != lp->tail; ep = ep->next) |