X-Git-Url: https://git.wirehaze.ovh/ppos.git/blobdiff_plain/61ce152bba6af0e2c2b15c99d50a3b2fc81d4aad..bc2a047d4475afe2334fb1b37cd417997284bb6d:/queue/queue.c?ds=inline diff --git a/queue/queue.c b/queue/queue.c index e54cb5e..13c43b4 100644 --- a/queue/queue.c +++ b/queue/queue.c @@ -52,18 +52,14 @@ queue_destroy (struct queue_t *queue) return ERROR; } - if (!(n = queue->head)) - { - free (queue); - return NOERROR; - } + n = queue->head; - do + while (n) { next = n->next; node_destroy (n); + n = next; } - while ((n = next)); free (queue); return NOERROR; @@ -168,12 +164,7 @@ queue_has (struct queue_t *queue, void *item) while (n->item != item && (n = n->next)) ; - if (!n) - { - return false; - } - - return true; + return n != NULL; } int