1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-15 08:34:05 +02:00
wernermisc/qpkg/id.h
Werner Almesberger 3d1ef02aba qpkg: added copyright headers and changed name to emphasize speediness
- Makefile, gobble.h, gobble.c, id.h, id.c, prereq.h, prereq.c, qpkg.h,
  qpkg.c, rbtest.c: added copyright header
- id.c: include jrb.h (for completeness)
- README: change name from "Query package databases" to "Quick package
  database query"
2010-11-20 07:29:18 -03:00

44 lines
1009 B
C

/*
* id.h - Registry of unique and alphabetically sorted identifiers
*
* Written 2010 by Werner Almesberger
* Copyright 2010 Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#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;
};
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 */