GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
Main Page
Related Pages
+
Data Structures
Data Structures
Class Hierarchy
+
Data Fields
+
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
+
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Related Functions
+
Files
File List
+
Globals
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
x
y
+
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
o
p
r
s
t
u
v
w
y
z
+
Enumerations
a
c
d
e
h
l
m
n
o
p
r
s
t
v
y
+
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
+
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
btree/find.c
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <
grass/btree.h
>
3
4
int
btree_find
(
const
BTREE
* B,
const
void
*key,
void
**data)
5
{
6
int
q;
7
int
dir;
8
9
10
if
(B->
N
<= 0)
11
return
0;
12
13
q = 1;
14
while
(q > 0) {
15
dir = (*B->
cmp
) (B->
node
[q].
key
, key);
16
if
(dir == 0) {
17
*data = B->
node
[q].
data
;
18
return
1;
19
}
20
if
(dir > 0)
21
q = B->
node
[q].
left
;
/* go left */
22
else
23
q = B->
node
[q].
right
;
/* go right */
24
}
25
26
return
0;
27
}
btree.h
BTREE::N
int N
Definition:
btree.h:16
BTREE_NODE::left
int left
Definition:
btree.h:8
btree_find
int btree_find(const BTREE *B, const void *key, void **data)
Definition:
btree/find.c:4
BTREE
Definition:
btree.h:12
BTREE_NODE::key
void * key
Definition:
btree.h:6
BTREE::cmp
int(* cmp)(const void *, const void *)
Definition:
btree.h:19
BTREE_NODE::data
void * data
Definition:
btree.h:7
BTREE::node
BTREE_NODE * node
Definition:
btree.h:14
BTREE_NODE::right
int right
Definition:
btree.h:9
lib
btree
find.c
Generated on Mon May 31 2021 05:21:29 for GRASS GIS 7 Programmer's Manual by
1.8.13