Our extension of the hashmap module.
More...
|
int | hashmap_put_tuple (struct hashmap_s *const m, const char *const key, const hashmap_uint32_t len, PyObject *py_key, PyObject *value) |
| Put a key-value pair into the hashmap.
|
|
struct map_tuple * | hashmap_pop_tuple (struct hashmap_s *const m, const char *const key, const hashmap_uint32_t len) |
| Remove a value from the hashmap.
|
|
void | hashmap_destroy_tuple (struct hashmap_s *m) |
| Destroy a hashmap, assuming the values are map_tuples.
|
|
void | hashmap_destroy_py (struct hashmap_s *m) |
| Destroy a hashmap, assuming the values are PyObjects.
|
|
Our extension of the hashmap module.
Since the Python dict object proved far too hermetic for our shenanigans we had to use a third-part hashmap library. We settled on https://github.com/sheredom/hashmap.h, and this module extends that library
◆ hashmap_destroy_py()
void hashmap_destroy_py |
( |
struct hashmap_s * |
m | ) |
|
Destroy a hashmap, assuming the values are PyObjects.
- Parameters
-
◆ hashmap_destroy_tuple()
void hashmap_destroy_tuple |
( |
struct hashmap_s * |
m | ) |
|
Destroy a hashmap, assuming the values are map_tuples.
- Parameters
-
◆ hashmap_pop_tuple()
struct map_tuple * hashmap_pop_tuple |
( |
struct hashmap_s *const |
m, |
|
|
const char *const |
key, |
|
|
const hashmap_uint32_t |
len |
|
) |
| |
Remove a value from the hashmap.
- Parameters
-
m | the hashmap to remove the value from |
key | the key to remove the value for |
len | the length of the key |
- Returns
- the removed value or NULL if not found
- Warning
- You must free the returned value, and decrement the reference count of the key and value
◆ hashmap_put_tuple()
int hashmap_put_tuple |
( |
struct hashmap_s *const |
m, |
|
|
const char *const |
key, |
|
|
const hashmap_uint32_t |
len, |
|
|
PyObject * |
py_key, |
|
|
PyObject * |
value |
|
) |
| |
Put a key-value pair into the hashmap.
- Parameters
-
m | the hashmap to put the pair into |
key | the key to put |
len | the length of the key |
py_key | the Python key object |
value | the value to put |
- Returns
- 0 on success, 1 on failure
- Note
- This funciton will increment the reference count of the key and value