| 352 | |
| 353 | |
| 354 | int h2_iq_add(h2_iqueue *q, int sid, h2_iq_cmp *cmp, void *ctx) |
| 355 | { |
| 356 | int i; |
| 357 | |
| 358 | if (h2_iq_contains(q, sid)) { |
| 359 | return 0; |
| 360 | } |
| 361 | if (q->nelts >= q->nalloc) { |
| 362 | iq_grow(q, q->nalloc * 2); |
| 363 | } |
| 364 | i = (q->head + q->nelts) % q->nalloc; |
| 365 | q->elts[i] = sid; |
| 366 | ++q->nelts; |
| 367 | |
| 368 | if (cmp) { |
| 369 | /* bubble it to the front of the queue */ |
| 370 | iq_bubble_up(q, i, q->head, cmp, ctx); |
| 371 | } |
| 372 | return 1; |
| 373 | } |
| 374 | |
| 375 | int h2_iq_append(h2_iqueue *q, int sid) |
| 376 | { |
no test coverage detected