* @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
| 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 | */ |
| 509 | void* 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 | } |
nothing calls this directly
no test coverage detected