/usr/include/bglibs/dict/dict.h is in libbg1-dev 1.106-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #ifndef DICT__H__
#define DICT__H__
#include "str/str.h"
#include "uint32.h"
#define DICT_HASHSTART 5381
uint32 dict_hashadd(uint32 h, const unsigned char* data, unsigned long len);
#define dict_hash(BUF,LEN) dict_hashadd(DICT_HASHSTART,BUF,LEN)
#define dict_hashstr(STR) dict_hashadd(DICT_HASHSTART,(const unsigned char*)(STR)->s,(STR)->len)
struct dict_entry
{
uint32 hash;
str key;
void* data;
};
typedef struct dict_entry dict_entry;
struct dict
{
unsigned size;
unsigned count;
dict_entry** table;
};
typedef struct dict dict;
extern int dict_init(dict*);
extern void dict_free(dict*, void (*free_data)(void*));
extern int dict_add(dict*, const str*, void*);
extern dict_entry* dict_get(dict*, const str*);
extern void dict_foreach(dict* d, void (*fn)(const str* key, void** dataptr));
extern void dict_str_free(void*);
#endif
|