[PATCH] Core: slight optimization in ngx_chain_update_chains()
胡聪 (hucc)
hucong.c at foxmail.com
Thu Nov 10 02:30:34 UTC 2016
Hi,
I found that sometimes the *out is NULL when i was reading the code
of ngx_event_pipe.c . So it is not necessary to traverse *busy when
*out == NULL in ngx_chain_update_chains().
# HG changeset patch
# User hucongcong <hucong.c at foxmail.com>
# Date 1478744273 -28800
# Thu Nov 10 10:17:53 2016 +0800
# Node ID c7b6269faec0d2ee6b4f4f625db8c219b5d0b010
# Parent 92ad1c92bcf93310bf59447dd581cac37af87adb
Core: slight optimization in ngx_chain_update_chains().
It is not necessary to traverse *busy and link the *out
when *out == NULL.
diff -r 92ad1c92bcf9 -r c7b6269faec0 src/core/ngx_buf.c
--- a/src/core/ngx_buf.c Fri Nov 04 19:12:19 2016 +0300
+++ b/src/core/ngx_buf.c Thu Nov 10 10:17:53 2016 +0800
@@ -189,7 +189,7 @@ ngx_chain_update_chains(ngx_pool_t *p, n
if (*busy == NULL) {
*busy = *out;
- } else {
+ } else if (*out) {
for (cl = *busy; cl->next; cl = cl->next) { /* void */ }
cl->next = *out;
More information about the nginx-devel
mailing list