• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef DB_NAMES_H_
2 #define DB_NAMES_H_ 1
3 
4 #define IDNAME_MAX 256
5 
6 struct db_entry {
7 	struct db_entry *next;
8 	unsigned int id;
9 	char *name;
10 };
11 
12 struct db_names {
13 	unsigned int size;
14 	struct db_entry *cached;
15 	struct db_entry **hash;
16 	int max;
17 };
18 
19 struct db_names *db_names_alloc(void);
20 int db_names_load(struct db_names *db, const char *path);
21 void db_names_free(struct db_names *db);
22 
23 char *id_to_name(struct db_names *db, int id, char *name);
24 int name_to_id(struct db_names *db, int *id, const char *name);
25 
26 #endif
27