# HG changeset patch # User Igor Sysoev # Date 1064421853 0 # Node ID 949f45d1589af7f0b2afd5278e28c44cc1fc7784 # Parent 049e78b1f852ad2668d7d10e7262cc3f685ac011 nginx-0.0.1-2003-09-24-20:44:13 import diff --git a/src/core/ngx_hunk.c b/src/core/ngx_hunk.c --- a/src/core/ngx_hunk.c +++ b/src/core/ngx_hunk.c @@ -97,3 +97,43 @@ ngx_hunk_t *ngx_create_hunk_after(ngx_po return h; } + + +void ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy, + ngx_chain_t **out) +{ + ngx_chain_t *te; + + if (*busy == NULL) { + *busy = *out; + + } else { + for (te = *busy; /* void */ ; te = te->next) { + if (te->next == NULL) { + te->next = *out; + break; + } + } + } + + *out = NULL; + + while (*busy) { + if ((*busy)->hunk->pos != (*busy)->hunk->last) { + break; + } + +#if (HAVE_WRITE_ZEROCOPY) + if ((*busy)->hunk->type & NGX_HUNK_ZEROCOPY_BUSY) { + break; + } +#endif + + (*busy)->hunk->pos = (*busy)->hunk->last = (*busy)->hunk->start; + + te = *busy; + *busy = (*busy)->next; + te->next = *free; + *free = te; + } +}