| 458 | } |
| 459 | |
| 460 | static void iq_grow(h2_iqueue *q, int nlen) |
| 461 | { |
| 462 | if (nlen > q->nalloc) { |
| 463 | int *nq = apr_pcalloc(q->pool, sizeof(int) * nlen); |
| 464 | if (q->nelts > 0) { |
| 465 | int l = ((q->head + q->nelts) % q->nalloc) - q->head; |
| 466 | |
| 467 | memmove(nq, q->elts + q->head, sizeof(int) * l); |
| 468 | if (l < q->nelts) { |
| 469 | /* elts wrapped, append elts in [0, remain] to nq */ |
| 470 | int remain = q->nelts - l; |
| 471 | memmove(nq + l, q->elts, sizeof(int) * remain); |
| 472 | } |
| 473 | } |
| 474 | q->elts = nq; |
| 475 | q->nalloc = nlen; |
| 476 | q->head = 0; |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | static void iq_swap(h2_iqueue *q, int i, int j) |
| 481 | { |
no outgoing calls
no test coverage detected