1critbit0_allprefixed(3)    Library Functions Manual    critbit0_allprefixed(3)
2
3
4

NAME

6       critbit0_allprefixed - search a critbit tree by prefix
7

SYNTAX

9       #include <critbit.h>
10
11       critbit0_tree cb = { 0 };
12
13       int critbit0_allprefixed(critbit0_tree* cb,const char* prefix,
14           int (*handle)(const char*,void*),void* arg);
15

DESCRIPTION

17       critbit0_allprefixed  calls  the  handle  function on all members of cb
18       that start with prefix. It passes arg as second argument to handle.
19
20       If handle returns 0, the search stops and critbit0_allprefixed  returns
21       0.
22
23       If  handle  returns  1,  the  search continues and critbit0_allprefixed
24       returns 1 if all keys with the given prefix were handled.
25
26       If handle returns something else, the search stops and critbit0_allpre‐
27       fixed returns -1.
28

NOTE

30       This  function uses recursion to traverse the tree. It may require non‐
31       trivial amounts of available stack space.
32

RETURN VALUE

34       1 if all keys were found and handled (or if there  were  no  keys  with
35       that prefix).
36
37       0 if at least one key was found, handle was called and returned 0.
38
39       -1  if at least one key was found, handle was called and returned some‐
40       thing other than 0 or 1.
41

SEE ALSO

43       critbit0_contains(3)
44
45
46
47                                                       critbit0_allprefixed(3)
Impressum