diff options
Diffstat (limited to 'src/core/ngx_buf.c')
-rw-r--r-- | src/core/ngx_buf.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/core/ngx_buf.c b/src/core/ngx_buf.c index b7f597d39..31d990315 100644 --- a/src/core/ngx_buf.c +++ b/src/core/ngx_buf.c @@ -151,6 +151,34 @@ ngx_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain, ngx_chain_t *in) } +ngx_chain_t * +ngx_chain_get_free_buf(ngx_pool_t *p, ngx_chain_t **free) +{ + ngx_chain_t *cl; + + if (*free) { + cl = *free; + *free = cl->next; + cl->next = NULL; + return cl; + } + + cl = ngx_alloc_chain_link(p); + if (cl == NULL) { + return NULL; + } + + cl->buf = ngx_calloc_buf(p); + if (cl->buf == NULL) { + return NULL; + } + + cl->next = NULL; + + return cl; +} + + void ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy, ngx_chain_t **out, ngx_buf_tag_t tag) |