Mercurial > hg > nginx
comparison src/core/ngx_buf.c @ 6797:40c2f3e06d23
Core: slight optimization in ngx_chain_update_chains().
It is not necessary to traverse *busy and link the *out when *out is NULL.
author | hucongcong <hucong.c@foxmail.com> |
---|---|
date | Thu, 10 Nov 2016 10:17:53 +0800 |
parents | ac3f78219f85 |
children | 7cc2d3a96ea3 |
comparison
equal
deleted
inserted
replaced
6796:92ad1c92bcf9 | 6797:40c2f3e06d23 |
---|---|
184 ngx_chain_update_chains(ngx_pool_t *p, ngx_chain_t **free, ngx_chain_t **busy, | 184 ngx_chain_update_chains(ngx_pool_t *p, ngx_chain_t **free, ngx_chain_t **busy, |
185 ngx_chain_t **out, ngx_buf_tag_t tag) | 185 ngx_chain_t **out, ngx_buf_tag_t tag) |
186 { | 186 { |
187 ngx_chain_t *cl; | 187 ngx_chain_t *cl; |
188 | 188 |
189 if (*busy == NULL) { | 189 if (*out) { |
190 *busy = *out; | 190 if (*busy == NULL) { |
191 | 191 *busy = *out; |
192 } else { | 192 |
193 for (cl = *busy; cl->next; cl = cl->next) { /* void */ } | 193 } else { |
194 | 194 for (cl = *busy; cl->next; cl = cl->next) { /* void */ } |
195 cl->next = *out; | 195 |
196 } | 196 cl->next = *out; |
197 | 197 } |
198 *out = NULL; | 198 |
199 *out = NULL; | |
200 } | |
199 | 201 |
200 while (*busy) { | 202 while (*busy) { |
201 cl = *busy; | 203 cl = *busy; |
202 | 204 |
203 if (ngx_buf_size(cl->buf) != 0) { | 205 if (ngx_buf_size(cl->buf) != 0) { |