* @brief Allocated capacity of the underlying vector. * * Capacity ≥ size; the queue can absorb (capacity - size) more * pushes without re-allocating. * * @param q Queue pointer. NULL returns 0. * @return Capacity in elements. */
| 237 | |
| 238 | size_t n = src->vec->size - src->frontIndex; |
| 239 | if (n > 0 && !vector_reserve(dest->vec, n)) { |
| 240 | QUEUE_LOG("[queue_assign]: reserve(%zu) failed -> false", n); |
| 241 | return false; |
| 242 | } |
| 243 | for (size_t i = 0; i < n; ++i) { |
| 244 | void* elem = vector_at(src->vec, src->frontIndex + i); |
| 245 | if (!elem || !vector_push_back(dest->vec, elem)) { |
| 246 | QUEUE_LOG("[queue_assign]: push_back failed at index %zu -> false", i); |
| 247 | return false; |
| 248 | } |
| 249 | } |
| 250 | QUEUE_LOG("[queue_assign]: exit ok (%zu elements assigned)", n); |
| 251 | return true; |
| 252 | } |
| 253 |
nothing calls this directly
no test coverage detected