]> git.kaiwu.me - nginx.git/commitdiff
Core: removed dead code in ngx_rbtree_delete().
authorVladimir Homutov <vl@nginx.com>
Mon, 30 Sep 2019 13:39:20 +0000 (16:39 +0300)
committerVladimir Homutov <vl@nginx.com>
Mon, 30 Sep 2019 13:39:20 +0000 (16:39 +0300)
The result of ngx_rbtree_min() is always a node with the left child equal to
sentinel, thus the check is unnecessary.

src/core/ngx_rbtree.c

index 969d549c857790d7538dd1f0b5385d18f73ee80f..377b82fcc76d4d5621e958b298539a199cebe8b4 100644 (file)
@@ -174,12 +174,7 @@ ngx_rbtree_delete(ngx_rbtree_t *tree, ngx_rbtree_node_t *node)
 
     } 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) {