]> wirehaze git hosting - ppos.git/commitdiff

wirehaze git hosting

simplify queue_destroy()
authorphfr24 <phfr24@inf.ufpr.br>
Sun, 1 Mar 2026 02:49:06 +0000 (23:49 -0300)
committerphfr24 <phfr24@inf.ufpr.br>
Sun, 1 Mar 2026 02:49:06 +0000 (23:49 -0300)
queue/queue.c

index e54cb5e4730ae7da41d846e2f609ffef20a5577e..1f5d3a7452465fd34fe18ea1d0099d7f17fbfbd2 100644 (file)
@@ -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;