mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-11-22 12:56:15 +02:00
e1814ce372
This is a change of the underlying mechanism but it's not polished or optimized yet. The compare functions haven't been updated, so they work but produce compiler warnings because of type mismatches. - Makefile (OBJS): added jrb.o - id.h, id.c: use jrb instead of own dumb binary trees - TODO: brag about the efficiency improvement
33 lines
645 B
C
33 lines
645 B
C
#ifndef ID_H
|
|
#define ID_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include "jrb.h"
|
|
|
|
|
|
struct id;
|
|
|
|
struct tree {
|
|
int (*comp)(const struct id *a, const struct id *b);
|
|
struct jrb *root;
|
|
};
|
|
|
|
struct id {
|
|
struct jrb *jrb;
|
|
const char *s;
|
|
size_t len;
|
|
void *value;
|
|
};
|
|
|
|
|
|
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));
|
|
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 */
|