[nginx] Core: removed dead code in ngx_rbtree_delete().

Vladimir Homutov vl at nginx.com
Mon Sep 30 13:49:12 UTC 2019


details:   https://hg.nginx.org/nginx/rev/7fdcf308e0f0
branches:  
changeset: 7576:7fdcf308e0f0
user:      Vladimir Homutov <vl at nginx.com>
date:      Mon Sep 30 16:39:20 2019 +0300
description:
Core: removed dead code in ngx_rbtree_delete().

The result of ngx_rbtree_min() is always a node with the left child equal to
sentinel, thus the check is unnecessary.

diffstat:

 src/core/ngx_rbtree.c |  7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diffs (17 lines):

diff -r d34a81b49214 -r 7fdcf308e0f0 src/core/ngx_rbtree.c
--- a/src/core/ngx_rbtree.c	Mon Sep 30 16:43:16 2019 +0300
+++ b/src/core/ngx_rbtree.c	Mon Sep 30 16:39:20 2019 +0300
@@ -174,12 +174,7 @@ ngx_rbtree_delete(ngx_rbtree_t *tree, ng
 
     } else {
         subst = ngx_rbtree_min(node->right, sentinel);
-
-        if (subst->left != sentinel) {
-            temp = subst->left;
-        } else {
-            temp = subst->right;
-        }
+        temp = subst->right;
     }
 
     if (subst == *root) {


More information about the nginx-devel mailing list