Commit 79cd22d3 authored by Akinobu Mita's avatar Akinobu Mita Committed by Mark Fasheh
Browse files

ocfs2: delete redundant memcmp()



This patch deletes redundant memcmp() while looking up in rb tree.
Signed-off-by: default avatarAkinbou Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
parent f1877fb2
...@@ -152,14 +152,16 @@ static struct o2nm_node *o2nm_node_ip_tree_lookup(struct o2nm_cluster *cluster, ...@@ -152,14 +152,16 @@ static struct o2nm_node *o2nm_node_ip_tree_lookup(struct o2nm_cluster *cluster,
struct o2nm_node *node, *ret = NULL; struct o2nm_node *node, *ret = NULL;
while (*p) { while (*p) {
int cmp;
parent = *p; parent = *p;
node = rb_entry(parent, struct o2nm_node, nd_ip_node); node = rb_entry(parent, struct o2nm_node, nd_ip_node);
if (memcmp(&ip_needle, &node->nd_ipv4_address, cmp = memcmp(&ip_needle, &node->nd_ipv4_address,
sizeof(ip_needle)) < 0) sizeof(ip_needle));
if (cmp < 0)
p = &(*p)->rb_left; p = &(*p)->rb_left;
else if (memcmp(&ip_needle, &node->nd_ipv4_address, else if (cmp > 0)
sizeof(ip_needle)) > 0)
p = &(*p)->rb_right; p = &(*p)->rb_right;
else { else {
ret = node; ret = node;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment