diff options
| author | Valentin Bartenev <vbart@nginx.com> | 2013-12-11 21:30:38 +0400 |
|---|---|---|
| committer | Valentin Bartenev <vbart@nginx.com> | 2013-12-11 21:30:38 +0400 |
| commit | 2576530c5123da466f75169418386887748b99b1 (patch) | |
| tree | 9d804e89743cfa64f3af0a207bd22727b92cfb70 /src/event/ngx_event_pipe.c | |
| parent | 7f54528ca07e49abd83d8c86c8125202dcf2798c (diff) | |
| download | nginx-2576530c5123da466f75169418386887748b99b1.tar.gz nginx-2576530c5123da466f75169418386887748b99b1.tar.bz2 | |
Use ngx_chain_get_free_buf() in pipe input filters.
No functional changes.
Diffstat (limited to 'src/event/ngx_event_pipe.c')
| -rw-r--r-- | src/event/ngx_event_pipe.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/event/ngx_event_pipe.c b/src/event/ngx_event_pipe.c index 6f685a9ed..eed807d61 100644 --- a/src/event/ngx_event_pipe.c +++ b/src/event/ngx_event_pipe.c @@ -857,19 +857,13 @@ ngx_event_pipe_copy_input_filter(ngx_event_pipe_t *p, ngx_buf_t *buf) return NGX_OK; } - if (p->free) { - cl = p->free; - b = cl->buf; - p->free = cl->next; - ngx_free_chain(p->pool, cl); - - } else { - b = ngx_alloc_buf(p->pool); - if (b == NULL) { - return NGX_ERROR; - } + cl = ngx_chain_get_free_buf(p->pool, &p->free); + if (cl == NULL) { + return NGX_ERROR; } + b = cl->buf; + ngx_memcpy(b, buf, sizeof(ngx_buf_t)); b->shadow = buf; b->tag = p->tag; @@ -877,14 +871,6 @@ ngx_event_pipe_copy_input_filter(ngx_event_pipe_t *p, ngx_buf_t *buf) b->recycled = 1; buf->shadow = b; - cl = ngx_alloc_chain_link(p->pool); - if (cl == NULL) { - return NGX_ERROR; - } - - cl->buf = b; - cl->next = NULL; - ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, "input buf #%d", b->num); if (p->in) { |
