[PATCH] Core: slight optimization in ngx_chain_update_chains()

Maxim Dounin mdounin at mdounin.ru
Fri Nov 11 19:11:13 UTC 2016


Hello!

On Fri, Nov 11, 2016 at 10:38:55AM +0800, 胡聪 (hucc) wrote:

> Hello!
> 
> 
> On Fri, Nov 11, 2016 at 0:55 AM, Maxim Dounin wrote:
> 
> >Looking into this again I tend to think that better solution would 
> >be to test *out in additional if around all operations with *out, 
> >like this (diff -w for clarity):
> >
> >@@ -186,6 +186,7 @@ ngx_chain_update_chains(ngx_pool_t *p, n
> > {
> >     ngx_chain_t  *cl;
> > 
> >+    if (*out) {
> >     if (*busy == NULL) {
> >         *busy = *out;
> > 
> >@@ -196,6 +197,7 @@ ngx_chain_update_chains(ngx_pool_t *p, n
> >     }
> > 
> >     *out = NULL;
> >+    }
> > 
> >     while (*busy) {
> >         cl = *busy;
> 
> Yes, it`s truly better!

Committed, thanks.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx-devel mailing list