Mercurial
diff dowa/dowa.h @ 52:636eab07809d
Fixed dowa memory problems. Add few more utility functions.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Fri, 19 Dec 2025 13:30:30 -0800 |
| parents | 84672efec192 |
| children | e06bc03d9618 |
line wrap: on
line diff
--- a/dowa/dowa.h Mon Dec 15 19:55:17 2025 -0800 +++ b/dowa/dowa.h Fri Dec 19 13:30:30 2025 -0800 @@ -54,6 +54,12 @@ extern void Dowa_Arena_Destroy(Dowa_PArena arena); /* Strdup but saves within the arena */ extern void *Dowa_Arena_Copy(Dowa_PArena p_arena, const void *src, size_t size); +/* Resets the arena offset to 0, allowing reuse without freeing */ +extern void Dowa_Arena_Reset(Dowa_PArena p_arena); +/* Returns the current number of bytes allocated in the arena */ +extern size_t Dowa_Arena_Get_Used(Dowa_PArena p_arena); +/* Returns the remaining capacity in bytes */ +extern size_t Dowa_Arena_Get_Remaining(Dowa_PArena p_arena); // --- HashMap --- // @@ -97,6 +103,12 @@ extern int32 Dowa_HashMap_Push_Value_With_Type_NoCopy(Dowa_PHashMap p_hash_map, const char *key, void *value, size_t value_size, Dowa_HashMap_ValueType type); /* Removes the entry with the specified key from the hashmap and frees its data if owned. */ extern void Dowa_HashMap_Pop_Key(Dowa_PHashMap p_hash_map, const char *key); +/* Returns TRUE if the key exists in the hashmap, FALSE otherwise. */ +extern boolean Dowa_HashMap_Has_Key(Dowa_PHashMap p_hash_map, const char *key); +/* Removes all entries from the hashmap without destroying it. */ +extern void Dowa_HashMap_Clear(Dowa_PHashMap p_hash_map); +/* Returns the number of entries currently in the hashmap. */ +extern uint32 Dowa_HashMap_Get_Count(Dowa_PHashMap p_hash_map); // --- Utility Functions --- // /* Prints all entries in the hashmap to stdout for debugging purposes. */