1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-22 13:19:42 +02:00
wernermisc/qpkg/id.h
Werner Almesberger a9f12d5666 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 *"
2010-11-19 21:53:43 -03:00

33 lines
615 B
C

#ifndef ID_H
#define ID_H
#include <sys/types.h>
#include "jrb.h"
struct id;
struct tree {
int (*comp)(const void *a, const void *b);
struct jrb *root;
};
struct id {
struct jrb *jrb;
const char *s;
size_t len;
void *value;
};
int comp_id(const void *a, const void *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);
const struct id *next_id(const struct id *id);
#endif /* !ID_H */