Welcome! Log In Create A New Profile

Advanced

[PATCH] Core: slight optimization in ngx_chain_update_chains()

胡聪 (hucc)
November 09, 2016 09:32PM
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@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;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Core: slight optimization in ngx_chain_update_chains()

胡聪 (hucc) 422 November 09, 2016 09:32PM

Re: [PATCH] Core: slight optimization in ngx_chain_update_chains()

Maxim Dounin 192 November 10, 2016 11:56AM

Re: [PATCH] Core: slight optimization in ngx_chain_update_chains()

胡聪 (hucc) 179 November 10, 2016 09:40PM

Re: [PATCH] Core: slight optimization in ngx_chain_update_chains()

Maxim Dounin 182 November 11, 2016 02:12PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 170
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready