blob: 950198bc42f0c1fa83c2e59531590f43d4f880c9 (
plain)
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
|
/*
* [https://gist.github.com/tonious/1377667]
*
* Public Domain Hashtable
* Copyright (c) 2011 Tony Thompson (tonious).
*/
#ifndef HASHTABLE_H
#define HASHTABLE_H
typedef struct Entry_s {
char *key;
void *value;
struct Entry_s *next;
} Entry;
typedef struct {
int size;
Entry **table;
unsigned long *map;
} Hashtable;
Hashtable *Hashtable_create(const unsigned int size);
void Hashtable_del(Hashtable *hashtable);
void Hashtable_set(Hashtable *hashtable, const void *key, const size_t len, void *value);
void *Hashtable_get(Hashtable *hashtable, const void *key, const size_t len);
int Hashtable_in(Hashtable *a, Hashtable *b);
#endif
|