mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-12-22 09:33:21 +02:00
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 *"
This commit is contained in:
parent
af27092667
commit
a9f12d5666
@ -7,7 +7,7 @@
|
||||
static struct id *free_id = NULL;
|
||||
|
||||
|
||||
int comp_id(const struct id *a, const struct id *b)
|
||||
static int do_comp_id(const struct id *a, const struct id *b)
|
||||
{
|
||||
int len = a->len < b->len ? a->len : b->len;
|
||||
int cmp;
|
||||
@ -19,7 +19,12 @@ int comp_id(const struct id *a, const struct id *b)
|
||||
}
|
||||
|
||||
|
||||
struct tree *make_tree(int (*comp)(const struct id *a, const struct id *b))
|
||||
int comp_id(const void *a, const void *b)
|
||||
{
|
||||
return do_comp_id(a, b);
|
||||
}
|
||||
|
||||
struct tree *make_tree(int (*comp)(const void *a, const void *b))
|
||||
{
|
||||
struct tree *tree;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
struct id;
|
||||
|
||||
struct tree {
|
||||
int (*comp)(const struct id *a, const struct id *b);
|
||||
int (*comp)(const void *a, const void *b);
|
||||
struct jrb *root;
|
||||
};
|
||||
|
||||
@ -21,9 +21,9 @@ struct id {
|
||||
};
|
||||
|
||||
|
||||
int comp_id(const struct id *a, const struct id *b);
|
||||
int comp_id(const void *a, const void *b);
|
||||
|
||||
struct tree *make_tree(int (*comp)(const struct id *a, const struct id *b));
|
||||
struct tree *make_tree(int (*comp)(const void *a, const void *b));
|
||||
struct id *make_id(struct tree *tree, const char *s, size_t len);
|
||||
const struct id *find_id(const struct tree *tree, const char *s, size_t len);
|
||||
const struct id *first_id(const struct tree *tree);
|
||||
|
Loading…
Reference in New Issue
Block a user