Mercurial > hg > nginx
comparison src/event/ngx_event_pipe.c @ 5466:e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
No functional changes.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Wed, 11 Dec 2013 21:30:38 +0400 |
parents | 3d2d3e1cf427 |
children | 35990c69b3ac |
comparison
equal
deleted
inserted
replaced
5465:a279d2a33dbf | 5466:e7b3b9855be8 |
---|---|
855 | 855 |
856 if (buf->pos == buf->last) { | 856 if (buf->pos == buf->last) { |
857 return NGX_OK; | 857 return NGX_OK; |
858 } | 858 } |
859 | 859 |
860 if (p->free) { | 860 cl = ngx_chain_get_free_buf(p->pool, &p->free); |
861 cl = p->free; | 861 if (cl == NULL) { |
862 b = cl->buf; | 862 return NGX_ERROR; |
863 p->free = cl->next; | 863 } |
864 ngx_free_chain(p->pool, cl); | 864 |
865 | 865 b = cl->buf; |
866 } else { | |
867 b = ngx_alloc_buf(p->pool); | |
868 if (b == NULL) { | |
869 return NGX_ERROR; | |
870 } | |
871 } | |
872 | 866 |
873 ngx_memcpy(b, buf, sizeof(ngx_buf_t)); | 867 ngx_memcpy(b, buf, sizeof(ngx_buf_t)); |
874 b->shadow = buf; | 868 b->shadow = buf; |
875 b->tag = p->tag; | 869 b->tag = p->tag; |
876 b->last_shadow = 1; | 870 b->last_shadow = 1; |
877 b->recycled = 1; | 871 b->recycled = 1; |
878 buf->shadow = b; | 872 buf->shadow = b; |
879 | 873 |
880 cl = ngx_alloc_chain_link(p->pool); | |
881 if (cl == NULL) { | |
882 return NGX_ERROR; | |
883 } | |
884 | |
885 cl->buf = b; | |
886 cl->next = NULL; | |
887 | |
888 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, "input buf #%d", b->num); | 874 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, "input buf #%d", b->num); |
889 | 875 |
890 if (p->in) { | 876 if (p->in) { |
891 *p->last_in = cl; | 877 *p->last_in = cl; |
892 } else { | 878 } else { |