Date:2010-11-19 23:52:39 (8 years 10 months ago)
Author:Werner Almesberger
Commit:cc92c670802bb7f7a0789777f86f0c3f00706216
Message: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
Files: qpkg/jrb.c (3 diffs)
qpkg/jrb.h (1 diff)
qpkg/rbtest.c (1 diff)

Change Details

qpkg/jrb.c
165165  return head;
166166}
167167
168JRB jrb_find_gte_gen(JRB n, const void *key,
168JRB jrb_find_gte(JRB n, const void *key,
169169    int (*fxn)(const void *, const void *), int *fnd)
170170{
171171  int cmp;
...... 
194194  }
195195}
196196
197JRB jrb_find_gen(JRB n, const void *key, int (*fxn)(const void *, const void *))
197JRB jrb_find(JRB n, const void *key, int (*fxn)(const void *, const void *))
198198{
199199  int fnd;
200200  JRB j;
201201
202  j = jrb_find_gte_gen(n, key, fxn, &fnd);
202  j = jrb_find_gte(n, key, fxn, &fnd);
203203  if (fnd) return j; else return NULL;
204204}
205205
...... 
494494  return n->val;
495495}
496496
497JRB jrb_insert_gen(JRB tree, void *key, void *val,
497JRB jrb_insert(JRB tree, void *key, void *val,
498498                          int (*func)(const void *, const void *))
499499{
500500  int fnd;
501501
502  return jrb_insert_b(jrb_find_gte_gen(tree, key, func, &fnd), key, val);
502  return jrb_insert_b(jrb_find_gte(tree, key, func, &fnd), key, val);
503503}
qpkg/jrb.h
6565   jrb_insert uses strcmp() as comparison funcion. jrb_inserti uses <>=,
6666   jrb_insertg uses func() */
6767
68extern JRB jrb_insert_gen(JRB tree, void *key, void *val,
68extern JRB jrb_insert(JRB tree, void *key, void *val,
6969    int (*func)(const void *, const void *));
7070
7171/* returns an external node in t whose value is equal k. Returns NULL if
7272   there is no such node in the tree */
7373
74extern JRB jrb_find_gen(JRB root, const void *,
74extern JRB jrb_find(JRB root, const void *,
7575    int (*func)(const void *, const void *));
7676
7777/* returns an external node in t whose value is equal
7878  k or whose value is the smallest value greater than k. Sets found to
7979  1 if the key was found, and 0 otherwise. */
8080
81extern JRB jrb_find_gte_gen(JRB root, const void *key,
81extern JRB jrb_find_gte(JRB root, const void *key,
8282    int (*func)(const void *, const void *), int *found);
8383
8484
qpkg/rbtest.c
1212
1313
1414#define INSERT(key, val) \
15    jrb_insert_gen(tree, key, val, cmp)
15    jrb_insert(tree, key, val, cmp)
1616
1717
1818int main(void)

Archive Download the corresponding diff file

Branches:
master



interactive