MCPcopy Create free account
hub / github.com/apache/httpd / h2_proxy_iq_sort

Function h2_proxy_iq_sort

modules/http2/h2_proxy_util.c:286–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286void 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
314int h2_proxy_iq_shift(h2_proxy_iqueue *q)

Callers

nothing calls this directly

Calls 2

iq_bubble_upFunction · 0.70
iq_bubble_downFunction · 0.70

Tested by

no test coverage detected