| 284 | } |
| 285 | |
| 286 | void h2_proxy_iq_sort(h2_proxy_iqueue *q, h2_proxy_iq_cmp *cmp, void *ctx) |
| 287 | { |
| 288 | /* Assume that changes in ordering are minimal. This needs, |
| 289 | * best case, q->nelts - 1 comparisons to check that nothing |
| 290 | * changed. |
| 291 | */ |
| 292 | if (q->nelts > 0) { |
| 293 | int i, ni, prev, last; |
| 294 | |
| 295 | /* Start at the end of the queue and create a tail of sorted |
| 296 | * entries. Make that tail one element longer in each iteration. |
| 297 | */ |
| 298 | last = i = (q->head + q->nelts - 1) % q->nalloc; |
| 299 | while (i != q->head) { |
| 300 | prev = (q->nalloc + i - 1) % q->nalloc; |
| 301 | |
| 302 | ni = iq_bubble_up(q, i, prev, cmp, ctx); |
| 303 | if (ni == prev) { |
| 304 | /* i bubbled one up, bubble the new i down, which |
| 305 | * keeps all tasks below i sorted. */ |
| 306 | iq_bubble_down(q, i, last, cmp, ctx); |
| 307 | } |
| 308 | i = prev; |
| 309 | }; |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | |
| 314 | int h2_proxy_iq_shift(h2_proxy_iqueue *q) |
nothing calls this directly
no test coverage detected