]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DOC: ebtree: indicate that prefix insertion/lookup may be used with strings
authorWilly Tarreau <w@1wt.eu>
Sat, 10 May 2014 06:34:01 +0000 (08:34 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 10 May 2014 06:36:19 +0000 (08:36 +0200)
And indicate what is required for this (that the pattern is properly
terminated by a zero).
(cherry picked from commit c87c93800ce4045b1053302d99a3cd78321a7ec4)

ebtree/ebmbtree.h

index 48dc13082f1ddc8340a6ec7c06cf0d048059b207..5ab115d0f9f74975e51b4913e652c3c50f0f8927 100644 (file)
@@ -373,7 +373,9 @@ __ebmb_insert(struct eb_root *root, struct ebmb_node *new, unsigned int len)
 
 /* Find the first occurence of the longest prefix matching a key <x> in the
  * tree <root>. It's the caller's responsibility to ensure that key <x> is at
- * least as long as the keys in the tree. If none can be found, return NULL.
+ * least as long as the keys in the tree. Note that this can be ensured by
+ * having a byte at the end of <x> which cannot be part of any prefix, typically
+ * the trailing zero for a string. If none can be found, return NULL.
  */
 static forceinline struct ebmb_node *__ebmb_lookup_longest(struct eb_root *root, const void *x)
 {
@@ -465,7 +467,9 @@ static forceinline struct ebmb_node *__ebmb_lookup_longest(struct eb_root *root,
 
 /* Find the first occurence of a prefix matching a key <x> of <pfx> BITS in the
  * tree <root>. It's the caller's responsibility to ensure that key <x> is at
- * least as long as the keys in the tree. If none can be found, return NULL.
+ * least as long as the keys in the tree. Note that this can be ensured by
+ * having a byte at the end of <x> which cannot be part of any prefix, typically
+ * the trailing zero for a string. If none can be found, return NULL.
  */
 static forceinline struct ebmb_node *__ebmb_lookup_prefix(struct eb_root *root, const void *x, unsigned int pfx)
 {