Date:2010-11-20 01:48:48 (8 years 9 months ago)
Author:Werner Almesberger
Commit:a9f12d56661a8e6def5a2b32519c3efd55e38d31
Message:qpkg: converted ID comparison from "struct id *" to "void *"

- id.h (struct tree, comp_id, make_tree), id.c (comp_id, make_tree):
comparison function now takes "void *" (pointing to a "struct id")
arguments instead of "struct id *", for compatibility with jrb
- id.c (comp_id, do_comp_id): added wrapper to convert "void *" back to
"struct id *"
Files: qpkg/id.c (2 diffs)
qpkg/id.h (2 diffs)

Change Details

qpkg/id.c
77static struct id *free_id = NULL;
88
99
10int comp_id(const struct id *a, const struct id *b)
10static int do_comp_id(const struct id *a, const struct id *b)
1111{
1212    int len = a->len < b->len ? a->len : b->len;
1313    int cmp;
...... 
1919}
2020
2121
22struct tree *make_tree(int (*comp)(const struct id *a, const struct id *b))
22int comp_id(const void *a, const void *b)
23{
24    return do_comp_id(a, b);
25}
26
27struct tree *make_tree(int (*comp)(const void *a, const void *b))
2328{
2429    struct tree *tree;
2530
qpkg/id.h
99struct id;
1010
1111struct tree {
12    int (*comp)(const struct id *a, const struct id *b);
12    int (*comp)(const void *a, const void *b);
1313    struct jrb *root;
1414};
1515
...... 
2121};
2222
2323
24int comp_id(const struct id *a, const struct id *b);
24int comp_id(const void *a, const void *b);
2525
26struct tree *make_tree(int (*comp)(const struct id *a, const struct id *b));
26struct tree *make_tree(int (*comp)(const void *a, const void *b));
2727struct id *make_id(struct tree *tree, const char *s, size_t len);
2828const struct id *find_id(const struct tree *tree, const char *s, size_t len);
2929const struct id *first_id(const struct tree *tree);

Archive Download the corresponding diff file

Branches:
master



interactive