added HashMap_pushOrUpdate

This commit is contained in:
2025-11-10 06:55:47 +05:00
parent 57c5942fcc
commit 0a1e87817d
2 changed files with 29 additions and 7 deletions

View File

@@ -29,6 +29,8 @@ typedef struct HashMap_ {
#define HashMap_construct(PTR, T, VALUE_DESTRUCTOR) HashMap_construct_size(PTR, sizeof(T), VALUE_DESTRUCTOR)
void HashMap_construct_size(HashMap_* ptr, u32 value_t_size, FreeFunction NULLABLE(value_destructor));
void HashMap_destroy(HashMap_* ptr);
void* NULLABLE(HashMap_tryGetPtr)(HashMap_* ptr, str key);
bool HashMap_tryPush(HashMap_* ptr, str key, void* value_ptr);
bool HashMap_tryDelete(HashMap_* ptr, str key);
bool HashMap_tryPush(HashMap_* ptr, const str key, void* value_ptr);
void HashMap_pushOrUpdate(HashMap_* ptr, const str key, void* value_ptr);
NULLABLE(void*) HashMap_tryGetPtr(const HashMap_* ptr, const str key);
bool HashMap_tryDelete(HashMap_* ptr, const str key);