git: f11a9f19b298 - main - pctrie: drop meaningless neighbor check

From: Doug Moore <dougm_at_FreeBSD.org>
Date: Fri, 25 Oct 2024 17:38:22 UTC
The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=f11a9f19b298e7d6dfa102275207e1b7c90aaff0

commit f11a9f19b298e7d6dfa102275207e1b7c90aaff0
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-10-25 17:37:01 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-10-25 17:37:01 +0000

    pctrie: drop meaningless neighbor check
    
    In PCTRIE_INSERT_LOOKUP_{G,L}E, there is a test - if two pointers are
    equal, replace one with a new value. The pointers can never be equal;
    one points to a struct pctrie_node and the other is the (void*) cast
    of a pointer to a field within a struct pctrie_node. So the tests and
    assignments can be removed with no effect.
    
    Reviewed by:    bnovkov
    Differential Revision:  https://reviews.freebsd.org/D47277
---
 sys/sys/pctrie.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/sys/sys/pctrie.h b/sys/sys/pctrie.h
index d71290c8cf23..209380d805b2 100644
--- a/sys/sys/pctrie.h
+++ b/sys/sys/pctrie.h
@@ -147,8 +147,6 @@ name##_PCTRIE_INSERT_LOOKUP_GE(struct pctrie *ptree, struct type *ptr,	\
 			*found_out = NULL;				\
 			return (ENOMEM);				\
 		}							\
-		if (neighbor == parentp)				\
-			neighbor = parent;				\
 		pctrie_insert_node(parentp, parent, val);		\
 	}								\
 	found = pctrie_subtree_lookup_gt(neighbor, *val);		\
@@ -178,8 +176,6 @@ name##_PCTRIE_INSERT_LOOKUP_LE(struct pctrie *ptree, struct type *ptr,	\
 			*found_out = NULL;				\
 			return (ENOMEM);				\
 		}							\
-		if (neighbor == parentp)				\
-			neighbor = parent;				\
 		pctrie_insert_node(parentp, parent, val);		\
 	}								\
 	found = pctrie_subtree_lookup_lt(neighbor, *val);		\