MCPcopy Create free account
hub / github.com/KaisenAmin/c_std / priority_queue_deallocate

Function priority_queue_deallocate

priority_queue/priority_queue.c:353–366  ·  view source on GitHub ↗

* @brief Destroy the priority queue and release all memory it owns. * * Frees both the underlying vector AND the PriorityQueue header. * NULL-safe. * * @param pq Queue to destroy. Pass NULL for a no-op. */

Source from the content-addressed store, hash-verified

351 * @param pq Queue to destroy. Pass NULL for a no-op.
352 */
353void priority_queue_deallocate(PriorityQueue* pq) {
354 PQUEUE_LOG("[priority_queue_deallocate]: enter pq=%p", (void*)pq);
355 if (!pq) {
356 PQUEUE_LOG("[priority_queue_deallocate]: NULL receiver, no-op");
357 return;
358 }
359 if (pq->vec) {
360 PQUEUE_LOG("[priority_queue_deallocate]: freeing vec=%p", (void*)pq->vec);
361 vector_deallocate(pq->vec);
362 pq->vec = NULL;
363 }
364 free(pq);
365 PQUEUE_LOG("[priority_queue_deallocate]: exit (queue header freed)");
366}
367
368
369/**

Callers 1

priority_queue_copyFunction · 0.85

Calls 1

vector_deallocateFunction · 0.85

Tested by

no test coverage detected