blob: 634da6043e87285b9ce185ed6a046ee6c48ba342 (
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
29
30
31
32
33
34
35
36
37
38
|
/*
* strmap.h
*
* A close-addressing based string -> string hash map
* for CISC 301: Operating Systems
*/
#ifndef H_STRMAP
#define H_STRMAP
#include <stdlib.h>
#include <string.h>
typedef struct strmap strmap;
typedef size_t (*hash_func) (const char *, size_t);
typedef enum {
STRMAP_OK,
STRMAP_ERR,
STRMAP_NOTFOUND
} strmap_status;
/*
* Inserts a new string into a strmap, returning
*/
strmap_status strmap_put(strmap*, const char*, const char*);
strmap_status strmap_get(const strmap*, const char*, const char**);
strmap_status strmap_delete(strmap*, const char*);
size_t strmap_size(const strmap*);
strmap *strmap_create(hash_func);
void strmap_destroy(strmap *);
#endif
|