4 #include <grass/btree.h>
6 static void *store(
const void *,
int);
9 const void *key,
int keylen,
const void *
data,
int datalen)
21 B->node[
N].key = store(key, keylen);
22 B->node[
N].data = store(data, datalen);
25 if (B->node[N].key && B->node[N].data)
36 dir = (*cmp) (B->node[
q].key, key);
38 free(B->node[q].data);
39 return ((B->node[q].data = store(data, datalen))) ? 1 : 0;
54 (BTREE_NODE *) realloc(B->node,
55 sizeof(BTREE_NODE) * (B->tlen += B->incr));
61 B->node[
N].key = store(key, keylen);
62 B->node[
N].data = store(data, datalen);
66 B->node[
N].right = -p;
70 B->node[
N].right = B->node[p].right;
76 static void *store(
const void *
s,
int n)
int btree_update(BTREE *B, const void *key, int keylen, const void *data, int datalen)