aboutsummaryrefslogtreecommitdiff
path: root/src/std
diff options
context:
space:
mode:
Diffstat (limited to 'src/std')
-rw-r--r--src/std/hash_map.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/std/hash_map.c b/src/std/hash_map.c
index 2b29f2e..48e9e38 100644
--- a/src/std/hash_map.c
+++ b/src/std/hash_map.c
@@ -192,7 +192,8 @@ bool hash_map_get(HashMap *self, BufferView key, void *value) {
BufferView bucket_key;
bucket_key = bucket_node_get_key(bucket_node);
if(hash == bucket_node_get_hash(bucket_node) && self->compare_func(&key, &bucket_key) == 0) {
- am_memcpy(value, bucket_node_get_value(bucket_node), self->value_type_size);
+ if(value)
+ am_memcpy(value, bucket_node_get_value(bucket_node), self->value_type_size);
return bool_true;
}
}
@@ -200,6 +201,10 @@ bool hash_map_get(HashMap *self, BufferView key, void *value) {
return bool_false;
}
+bool hash_map_contains(HashMap *self, BufferView key) {
+ return hash_map_get(self, key, NULL);
+}
+
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int hash_map_compare_string(const void *a, const void *b) {