---
name: "critbit0_allprefixed"
section: "3"
platform: "linux"
package: "libowfat-dev"
version: "0.32-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/critbit0_allprefixed"
---

# critbit0\_allprefixed(3)

search a critbit tree by prefix

## NAME

critbit0\_allprefixed - search a critbit tree by prefix

## SYNTAX

**#include \<libowfat/critbit.h\>**

critbit0\_tree cb = { 0 };

int **critbit0\_allprefixed**(critbit0\_tree\* *cb*,const char\* *prefix*,\
     int (\*handle)(const char\*,void\*),void\* arg);

## DESCRIPTION

critbit0\_allprefixed calls the *handle* function on all members of *cb* that start with *prefix*. It passes *arg* as second argument to *handle*.

If *handle* returns 0, the search stops and critbit0\_allprefixed returns 0.

If *handle* returns 1, the search continues and critbit0\_allprefixed returns 1 if all keys with the given prefix were handled.

If *handle* returns something else, the search stops and critbit0\_allprefixed returns -1.

## NOTE

This function uses recursion to traverse the tree. It may require nontrivial amounts of available stack space.

## RETURN VALUE

1 if all keys were found and handled (or if there were no keys with that prefix).

0 if at least one key was found, *handle* was called and returned 0.

\-1 if at least one key was found, *handle* was called and returned something other than 0 or 1.

## SEE ALSO

[critbit0\_contains(3)](/critbit0_contains/3.md)
