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

Function queue_push

queue/queue.c:287–304  ·  view source on GitHub ↗

* @brief Push a copy of @p item onto the back of the queue. * * Copies exactly `queue_item_size(q)` bytes from @p item into the * queue. The caller's buffer can be reused or freed afterwards — the * queue owns the copy. * * @param q Destination queue. * @param item Pointer to the value to copy. Must NOT be NULL. * * @return true on success, false on NULL inputs or underlying vector *

Source from the content-addressed store, hash-verified

285 * @param q Queue pointer. NULL returns 0.
286 * @return Capacity in elements.
287 */
288size_t queue_capacity(const Queue* q) {
289 QUEUE_LOG("[queue_capacity]: enter q=%p", (const void*)q);
290
291 if (!q || !q->vec) {
292 QUEUE_LOG("[queue_capacity]: NULL receiver -> 0");
293 return 0;
294 }
295 size_t out = vector_capacity((Vector*)q->vec);
296 QUEUE_LOG("[queue_capacity]: exit -> %zu", out);
297
298 return out;
299}
300
301
302/**
303 * @brief Bytes per element (as supplied to @ref queue_create).
304 *
305 * @param q Queue pointer. NULL returns 0.
306 * @return Per-element size in bytes.
307 */

Callers

nothing calls this directly

Calls 3

qbuf_compactFunction · 0.85
vector_push_backFunction · 0.85
vector_sizeFunction · 0.85

Tested by

no test coverage detected