[nginx] Core: slight optimization in ngx_chain_update_chains().
Maxim Dounin
mdounin at mdounin.ru
Fri Nov 11 19:10:47 UTC 2016
details: http://hg.nginx.org/nginx/rev/40c2f3e06d23
branches:
changeset: 6797:40c2f3e06d23
user: hucongcong <hucong.c at foxmail.com>
date: Thu Nov 10 10:17:53 2016 +0800
description:
Core: slight optimization in ngx_chain_update_chains().
It is not necessary to traverse *busy and link the *out when *out is NULL.
diffstat:
src/core/ngx_buf.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diffs (30 lines):
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;
More information about the nginx-devel
mailing list