From: hucongcong Date: Thu, 10 Nov 2016 02:17:53 +0000 (+0800) Subject: Core: slight optimization in ngx_chain_update_chains(). X-Git-Tag: release-1.11.6~4 X-Git-Url: http://www.kaiwu.me/postgresql/commit/static/gitweb.js?a=commitdiff_plain;h=42298aeb13040cc94026a2d405726895fb19b1e0;p=nginx.git Core: slight optimization in ngx_chain_update_chains(). It is not necessary to traverse *busy and link the *out when *out is NULL. --- diff --git a/src/core/ngx_buf.c b/src/core/ngx_buf.c index 00b664458..d30a0a4fc 100644 --- a/src/core/ngx_buf.c +++ b/src/core/ngx_buf.c @@ -186,16 +186,18 @@ ngx_chain_update_chains(ngx_pool_t *p, ngx_chain_t **free, ngx_chain_t **busy, { ngx_chain_t *cl; - if (*busy == NULL) { - *busy = *out; + if (*out) { + if (*busy == NULL) { + *busy = *out; - } else { - for (cl = *busy; cl->next; cl = cl->next) { /* void */ } + } else { + for (cl = *busy; cl->next; cl = cl->next) { /* void */ } - cl->next = *out; - } + cl->next = *out; + } - *out = NULL; + *out = NULL; + } while (*busy) { cl = *busy;