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

Function priority_queue_back

priority_queue/priority_queue.c:506–521  ·  view source on GitHub ↗

* @brief Borrowed pointer to the LAST slot of the underlying heap * storage. * * Diagnostic / iteration helper only — this is NOT in general the * lowest-priority element. The heap property only constrains * parent/child relationships; the leaves do not form a total order. * Use sorted-iteration via repeated pop if you need ordering. * * @param pq Queue pointer. * @return Pointer t

Source from the content-addressed store, hash-verified

504 *
505 * @param pq Queue pointer.
506 * @return Pointer to the last storage slot, or NULL if @p pq is NULL
507 * or empty.
508 */
509void* priority_queue_back(const PriorityQueue* pq) {
510 PQUEUE_LOG("[priority_queue_back]: enter pq=%p", (const void*)pq);
511 if (!pq || !pq->vec) {
512 PQUEUE_LOG("[priority_queue_back]: NULL receiver -> NULL");
513 return NULL;
514 }
515 if (vector_is_empty(pq->vec)) {
516 PQUEUE_LOG("[priority_queue_back]: empty queue -> NULL");
517 return NULL;
518 }
519
520 void* out = vector_back(pq->vec);
521 PQUEUE_LOG("[priority_queue_back]: exit -> %p", out);
522
523 return out;
524}

Callers

nothing calls this directly

Calls 2

vector_is_emptyFunction · 0.85
vector_backFunction · 0.85

Tested by

no test coverage detected