| 112 int cx_map_put(CxMap *map, CxHashKey key, void *value) { |
112 int cx_map_put(CxMap *map, CxHashKey key, void *value) { |
| 113 return map->cl->put(map, key, value).key == NULL; |
113 return map->cl->put(map, key, value).key == NULL; |
| 114 } |
114 } |
| 115 |
115 |
| 116 void *cx_map_emplace(CxMap *map, CxHashKey key) { |
116 void *cx_map_emplace(CxMap *map, CxHashKey key) { |
| 117 return map->cl->put(map, key, NULL).value; |
117 const CxMapEntry entry = map->cl->put(map, key, NULL); |
| |
118 if (entry.key == NULL) return NULL; |
| |
119 return entry.value; |
| 118 } |
120 } |
| 119 |
121 |
| 120 void *cx_map_get(const CxMap *map, CxHashKey key) { |
122 void *cx_map_get(const CxMap *map, CxHashKey key) { |
| 121 return map->cl->get(map, key); |
123 return map->cl->get(map, key); |
| 122 } |
124 } |