diff options
Diffstat (limited to 'src/hash.h')
| -rw-r--r-- | src/hash.h | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -81,16 +81,18 @@ inline V* wayc_hashmap_insert(hashmap_s<K, V>* map, const K* key, } template <typename K, typename V> -inline V* wayc_hashmap_get(hashmap_s<K, V>* map, const K* key) { +inline bool wayc_hashmap_get(hashmap_s<K, V>* map, const K* key, V* out) { wayc_notnull(map); wayc_notnull(key); + wayc_notnull(out); hashentry_s<K, V> entry{}; entry.key = *key; auto* stored = (hashentry_s<K, V>*)hashmap_get(map->inner, &entry); - if (!stored) return nullptr; + if (!stored) return false; - return &stored->value; + *out = stored->value; + return true; } template <typename K, typename V> |
