mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-11-22 14:08:26 +02:00
qpkg: (jrb) remove _gen suffix, since we removed the non-generic variants
- jrb.h, jrb.c (jrb_find_gte_gen): renamed to jrb_find_gte - jrb.h, jrb.c (jrb_find_gen): renamed to jrb_find - jrb.h, jrb.c (jrb_insert_gen): renamed to jrb_insert - rbtest.c (INSERT): track jrb_insert_gen name change
This commit is contained in:
parent
7f05c9e284
commit
cc92c67080
10
qpkg/jrb.c
10
qpkg/jrb.c
@ -165,7 +165,7 @@ JRB make_jrb(void)
|
||||
return head;
|
||||
}
|
||||
|
||||
JRB jrb_find_gte_gen(JRB n, const void *key,
|
||||
JRB jrb_find_gte(JRB n, const void *key,
|
||||
int (*fxn)(const void *, const void *), int *fnd)
|
||||
{
|
||||
int cmp;
|
||||
@ -194,12 +194,12 @@ JRB jrb_find_gte_gen(JRB n, const void *key,
|
||||
}
|
||||
}
|
||||
|
||||
JRB jrb_find_gen(JRB n, const void *key, int (*fxn)(const void *, const void *))
|
||||
JRB jrb_find(JRB n, const void *key, int (*fxn)(const void *, const void *))
|
||||
{
|
||||
int fnd;
|
||||
JRB j;
|
||||
|
||||
j = jrb_find_gte_gen(n, key, fxn, &fnd);
|
||||
j = jrb_find_gte(n, key, fxn, &fnd);
|
||||
if (fnd) return j; else return NULL;
|
||||
}
|
||||
|
||||
@ -494,10 +494,10 @@ void *jrb_val(JRB n)
|
||||
return n->val;
|
||||
}
|
||||
|
||||
JRB jrb_insert_gen(JRB tree, void *key, void *val,
|
||||
JRB jrb_insert(JRB tree, void *key, void *val,
|
||||
int (*func)(const void *, const void *))
|
||||
{
|
||||
int fnd;
|
||||
|
||||
return jrb_insert_b(jrb_find_gte_gen(tree, key, func, &fnd), key, val);
|
||||
return jrb_insert_b(jrb_find_gte(tree, key, func, &fnd), key, val);
|
||||
}
|
||||
|
@ -65,20 +65,20 @@ extern JRB make_jrb(void); /* Creates a new rb-tree */
|
||||
jrb_insert uses strcmp() as comparison funcion. jrb_inserti uses <>=,
|
||||
jrb_insertg uses func() */
|
||||
|
||||
extern JRB jrb_insert_gen(JRB tree, void *key, void *val,
|
||||
extern JRB jrb_insert(JRB tree, void *key, void *val,
|
||||
int (*func)(const void *, const void *));
|
||||
|
||||
/* returns an external node in t whose value is equal k. Returns NULL if
|
||||
there is no such node in the tree */
|
||||
|
||||
extern JRB jrb_find_gen(JRB root, const void *,
|
||||
extern JRB jrb_find(JRB root, const void *,
|
||||
int (*func)(const void *, const void *));
|
||||
|
||||
/* returns an external node in t whose value is equal
|
||||
k or whose value is the smallest value greater than k. Sets found to
|
||||
1 if the key was found, and 0 otherwise. */
|
||||
|
||||
extern JRB jrb_find_gte_gen(JRB root, const void *key,
|
||||
extern JRB jrb_find_gte(JRB root, const void *key,
|
||||
int (*func)(const void *, const void *), int *found);
|
||||
|
||||
|
||||
|
@ -12,7 +12,7 @@ static int cmp(const void *a, const void *b)
|
||||
|
||||
|
||||
#define INSERT(key, val) \
|
||||
jrb_insert_gen(tree, key, val, cmp)
|
||||
jrb_insert(tree, key, val, cmp)
|
||||
|
||||
|
||||
int main(void)
|
||||
|
Loading…
Reference in New Issue
Block a user