[BUILD] ebtree: update to v6.0.1 to remove references to dprintf()
Cyril Bonté reported a build breakage with glibc >= 2.10 due to a name clash
in dprintf(). Let's remove it, it's unused anyway.
diff --git a/ebtree/ebmbtree.h b/ebtree/ebmbtree.h
index 78a17c1..6497bd9 100644
--- a/ebtree/ebmbtree.h
+++ b/ebtree/ebmbtree.h
@@ -1,6 +1,6 @@
/*
* Elastic Binary Trees - macros and structures for Multi-Byte data nodes.
- * Version 6.0
+ * Version 6.0.1
* (C) 2002-2010 - Willy Tarreau <w@1wt.eu>
*
* This program is free software; you can redistribute it and/or modify
@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define dprintf(x,...) do { } while(0)
-
#ifndef _EBMBTREE_H
#define _EBMBTREE_H
@@ -605,7 +603,6 @@
if (len > old->node.pfx)
len = old->node.pfx;
bit = equal_bits(new->key, old->key, bit, len);
- dprintf(" [new=%p, old=%p] obit=%d, eqbit=%d\n", new, old, old->node.bit, bit);
break;
}
@@ -613,7 +610,6 @@
bit = equal_bits(new->key, old->key, bit, old_node_bit >> 1);
bit = (bit << 1) + 1; // assume comparisons with normal nodes
- dprintf(" [old=%p, new=%p] bit=%d/2, old_bit=%d/2\n", old, new, bit, old_node_bit);
/* we must always check that our prefix is larger than the nodes
* we visit, otherwise we have to stop going down. The following
@@ -625,7 +621,6 @@
up_ptr = &old->node.node_p;
new->node.bit = new->node.pfx << 1;
diff = -1;
- dprintf(" [new=%p, old=%p] obit=%d, nbit=%d (1)\n", new, old, old->node.bit, new->node.bit);
goto insert_above;
}
@@ -639,7 +634,6 @@
up_ptr = &old->node.node_p;
new->node.bit = bit;
diff = cmp_bits(new->key, old->key, bit >> 1);
- dprintf(" --> diff=%d, node.bit=%d/2\n", diff, new->node.bit);
goto insert_above;
}
@@ -653,7 +647,6 @@
root = &old->node.branches;
side = EB_LEFT;
troot = root->b[side];
- dprintf(" --> going down cover by left\n");
continue;
}
@@ -662,7 +655,6 @@
bit = old_node_bit >> 1; /* recheck that bit */
root = &old->node.branches;
troot = root->b[side];
- dprintf(" --> going down cover by right\n");
continue;
}
@@ -712,7 +704,6 @@
if (bit > old->node.pfx)
bit = old->node.pfx;
- dprintf(" [old=%p, new=%p] bit2=%d\n", old, new, bit);
new->node.bit = (bit << 1) + 1; /* assume normal node by default */
/* if one prefix is included in the second one, we don't compare bits
@@ -731,7 +722,6 @@
*/
new->node.bit--; /* anticipate cover node insertion */
if (new->node.pfx == old->node.pfx) {
- dprintf(" [inserting dup %p->%p]\n", old, new);
new->node.bit = -1; /* mark as new dup tree, just in case */
if (unlikely(eb_gettag(root_right))) {
@@ -760,14 +750,12 @@
new_leaf = eb_dotag(&new->node.branches, EB_LEAF);
if (diff >= 0) {
- dprintf(" [old=%p, new=%p] inserting right, obit=%d/2, nbit=%d/2\n", old, new, old->node.bit, new->node.bit);
new->node.branches.b[EB_LEFT] = troot;
new->node.branches.b[EB_RGHT] = new_leaf;
new->node.leaf_p = new_rght;
*up_ptr = new_left;
}
else {
- dprintf(" [old=%p, new=%p] inserting left, obit=%d/2, nbit=%d/2\n", old, new, old->node.bit, new->node.bit);
new->node.branches.b[EB_LEFT] = new_leaf;
new->node.branches.b[EB_RGHT] = troot;
new->node.leaf_p = new_left;
diff --git a/ebtree/ebtree.h b/ebtree/ebtree.h
index 60fc197..a9de5d6 100644
--- a/ebtree/ebtree.h
+++ b/ebtree/ebtree.h
@@ -1,6 +1,6 @@
/*
* Elastic Binary Trees - generic macros and structures.
- * Version 6.0
+ * Version 6.0.1
* (C) 2002-2010 - Willy Tarreau <w@1wt.eu>
*
* This program is free software; you can redistribute it and/or modify
@@ -519,6 +519,12 @@
* Public functions, for the end-user *
\**************************************/
+/* Return non-zero if the tree is empty, otherwise zero */
+static inline int eb_is_empty(struct eb_root *root)
+{
+ return !root->b[EB_LEFT];
+}
+
/* Return the first leaf in the tree starting at <root>, or NULL if none */
static inline struct eb_node *eb_first(struct eb_root *root)
{