Loading...
Searching...
No Matches
btree/find.c
Go to the documentation of this file.
#include <stdio.h>
#include <grass/btree.h>
int btree_find(const BTREE *B, const void *key, void **data)
{
int q;
int dir;
if (B->N <= 0)
return 0;
q = 1;
while (q > 0) {
dir = (*B->cmp)(B->node[q].key, key);
if (dir == 0) {
*data = B->node[q].data;
return 1;
}
if (dir > 0)
q = B->node[q].left; /* go left */
else
q = B->node[q].right; /* go right */
}
return 0;
}
btree_find
int btree_find(const BTREE *B, const void *key, void **data)
Definition btree/find.c:4