Queue/Definition: Difference between revisions
Content added Content deleted
Line 715: | Line 715: | ||
if (q->tail >= q->alloc) q->tail = 0; |
if (q->tail >= q->alloc) q->tail = 0; |
||
q->buf[q->tail++] = n; |
q->buf[q->tail++] = n; |
||
// Previous code was (q->tail == q->) array fails to resize when you use test |
// Previous code was (q->tail == q->head) array fails to resize when you use test |
||
// cases other than the provided one, this fixes it |
// cases other than the provided one, this fixes it |
||
if (q->tail == q->alloc) { /* needs more room */ |
if (q->tail == q->alloc) { /* needs more room */ |