diff options
author | hucongcong <hucong.c@foxmail.com> | 2016-11-10 10:17:53 +0800 |
---|---|---|
committer | hucongcong <hucong.c@foxmail.com> | 2016-11-10 10:17:53 +0800 |
commit | 42298aeb13040cc94026a2d405726895fb19b1e0 (patch) | |
tree | 2cefcb79f5ca551a9a72339bd82d02062b9fba3d /src/core/ngx_buf.c | |
parent | 8e9f1df637160ec20990601976e140b8d3cffc0b (diff) | |
download | nginx-42298aeb13040cc94026a2d405726895fb19b1e0.tar.gz nginx-42298aeb13040cc94026a2d405726895fb19b1e0.zip |
Core: slight optimization in ngx_chain_update_chains().
It is not necessary to traverse *busy and link the *out when *out is NULL.
Diffstat (limited to 'src/core/ngx_buf.c')
-rw-r--r-- | src/core/ngx_buf.c | 16 |
1 files changed, 9 insertions, 7 deletions
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; |