Skip to contentSkip to conversation

ocfs2: delete redundant memcmp()

PATCH In review Akinobu Mita 2 participants 2 messages Oct 12, 2006 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ocfs2: delete redundant memcmp()

This patch deletes redundant memcmp() while looking up in rb tree.

Cc Mark Fasheh <[email protected]>
Cc Kurt Hackel <[email protected]>
 fs/ocfs2/cluster/nodemanager.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
fs/ocfs2/cluster/nodemanager.c +6 -4
Index: work-fault-inject/fs/ocfs2/cluster/nodemanager.c
===================================================================
@@ -152,14 +152,16 @@ static struct o2nm_node *o2nm_node_ip_tr
 	struct o2nm_node *node, *ret = NULL;
 
 	while (*p) {
+		int cmp;
+
 		parent = *p;
 		node = rb_entry(parent, struct o2nm_node, nd_ip_node);
 
-		if (memcmp(&ip_needle, &node->nd_ipv4_address,
-		           sizeof(ip_needle)) < 0)
+		cmp = memcmp(&ip_needle, &node->nd_ipv4_address,
+				sizeof(ip_needle));
+		if (cmp < 0)
 			p = &(*p)->rb_left;
-		else if (memcmp(&ip_needle, &node->nd_ipv4_address,
-			        sizeof(ip_needle)) > 0)
+		else if (cmp > 0)
 			p = &(*p)->rb_right;
 		else {
 			ret = node;
#1 lore raw
Quoted 1 line · Akinobu Mita

This patch deletes redundant memcmp() while looking up in rb tree.

Looks good, thanks.

	--Mark

--
Mark Fasheh
Senior Software Developer, Oracle
[email protected]