--- a/docs/Writerside/topics/map.h.md Sun Dec 14 16:21:09 2025 +0100 +++ b/docs/Writerside/topics/map.h.md Sun Dec 14 17:30:17 2025 +0100 @@ -9,19 +9,16 @@ CxMap *cxHashMapCreate(const CxAllocator *allocator, size_t itemsize, size_t buckets); - -CxMap *cxHashMapCreateSimple(size_t itemsize); ``` The function `cxHashMapCreate()` creates a new map where both the map structure and the contained buckets are allocated by the specified `allocator`. -The [default allocator](allocator.h.md#default-allocator) is used in `cxHashMapCreateSimple()`. The map will store items of size `itemsize`. You can use the `CX_STORE_POINTERS` macro for `itemsize` to indicate that the map shall store pointers instead of actual items. -If you pass zero for the number of `buckets`, or use `cxHashMapSimple()`, +If you pass zero for the number of `buckets`, the map is initialized with a default of 16 buckets; otherwise the specified number of buckets is allocated. > If you want to lazy-initialize maps, you can use the global `cxEmptyMap` symbol as a placeholder instead of using a `NULL`-pointer. @@ -41,7 +38,7 @@ #include <cx/hash_map.h> int main() { - CxMap *contacts = cxHashMapCreateSimple(CX_STORE_POINTERS); + CxMap *contacts = cxHashMapCreate(NULL, CX_STORE_POINTERS, 0); // Build a small phone book cxMapPut(contacts, "John", "123-0815"); @@ -92,9 +89,9 @@ int main() { // store strings in the map... - CxMap *contacts = cxHashMapCreateSimple(sizeof(cxmutstr)); + CxMap *contacts = cxHashMapCreate(NULL, sizeof(cxmutstr), 0); // ...which are automatically freed when removed - cxDefineDestructor(contacts, cx_strfree); + cxSetDestructor(contacts, cx_strfree); // build a small interactive program const unsigned buffer_size = 256;