parallax
1.0
command-line based task/todo manager
Loading...
Searching...
No Matches
hashmap.h
Go to the documentation of this file.
1
#ifndef HASHMAP_H
2
#define HASHMAP_H
3
4
#include "
task.h
"
5
11
15
typedef
struct
Entry
{
16
char
*
key
;
17
void
*
value
;
18
struct
Entry
*
next
;
19
}
Entry
;
20
26
typedef
struct
HashMap
{
27
Entry
**
buckets
;
28
size_t
table_size
;
29
}
HashMap
;
30
31
38
HashMap
*
hashmap_create
(
size_t
table_size);
39
47
void
hashmap_set
(
HashMap
* map,
char
* key,
void
* value);
48
58
void
*
hashmap_get
(
HashMap
* map,
char
* key);
59
66
void
hashmap_elem_remove
(
HashMap
* map,
char
* key);
67
73
void
hashmap_destroy
(
HashMap
* map);
74
75
#endif
//HASHMAP_H
hashmap_create
HashMap * hashmap_create(size_t table_size)
Creates a hashmap of a fixed size.
Definition
hashmap.c:32
hashmap_set
void hashmap_set(HashMap *map, char *key, void *value)
Adds an entry to a hashmap by a key string and value.
Definition
hashmap.c:42
hashmap_destroy
void hashmap_destroy(HashMap *map)
Frees a hashmap to memory.
Definition
hashmap.c:132
hashmap_elem_remove
void hashmap_elem_remove(HashMap *map, char *key)
Removes an entry in a hashmap by its key.
Definition
hashmap.c:102
hashmap_get
void * hashmap_get(HashMap *map, char *key)
Finds an entry in a non-empty hashmap by a key.
Definition
hashmap.c:80
Entry
Linked list node definition of an entry in a hash map.
Definition
hashmap.h:15
Entry::next
struct Entry * next
Definition
hashmap.h:18
Entry::key
char * key
Definition
hashmap.h:16
Entry::value
void * value
Definition
hashmap.h:17
HashMap
Hashmap structure.
Definition
hashmap.h:26
HashMap::table_size
size_t table_size
Definition
hashmap.h:28
HashMap::buckets
Entry ** buckets
Definition
hashmap.h:27
task.h
Contains structures and functions for handling task-related operations.
include
hashmap.h
Generated by
1.14.0