From: phfr24 Date: Sun, 1 Mar 2026 02:49:06 +0000 (-0300) Subject: simplify queue_destroy() X-Git-Tag: queue~3 X-Git-Url: https://git.wirehaze.ovh/ppos.git/commitdiff_plain/51bba96d7dec4cbd44e5000dc7043a992ab8c3da?hp=2d4748477a9b5599a0ca9d2dc8a97fc553c9b002 simplify queue_destroy() --- diff --git a/queue/queue.c b/queue/queue.c index e54cb5e..1f5d3a7 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;