# HG changeset patch # User hucongcong # Date 1478744273 -28800 # Node ID 40c2f3e06d2378dea729eae9ddc381928853238d # Parent 92ad1c92bcf93310bf59447dd581cac37af87adb 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 --- a/src/core/ngx_buf.c +++ b/src/core/ngx_buf.c @@ -186,17 +186,19 @@ ngx_chain_update_chains(ngx_pool_t *p, n { 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;