diff -r 809581724cc7 -r 0358f1d9c506 ui/common/document.c --- a/ui/common/document.c Sat Apr 15 21:06:45 2023 +0200 +++ b/ui/common/document.c Mon May 22 16:17:26 2023 +0200 @@ -32,10 +32,13 @@ #include "document.h" -static UcxMap *documents; +#include +#include + +static CxMap *documents; void uic_docmgr_init() { - documents = ucx_map_new(32); + documents = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 32); } void ui_set_document(UiObject *obj, void *document) { @@ -77,15 +80,16 @@ } void* ui_document_new(size_t size) { - UcxMempool *mp = ucx_mempool_new(256); - UiContext *ctx = ucx_mempool_calloc(mp, 1, sizeof(UiContext)); + CxMempool *mp = cxBasicMempoolCreate(256); + const CxAllocator *a = mp->allocator; + UiContext *ctx = cxCalloc(a, 1, sizeof(UiContext)); ctx->attach_document = uic_context_attach_document; ctx->detach_document2 = uic_context_detach_document2; - ctx->mempool = mp; - ctx->vars = ucx_map_new_a(mp->allocator, 16); + ctx->allocator = a; + ctx->vars = cxHashMapCreate(a, CX_STORE_POINTERS, 16); - void *document = ucx_mempool_calloc(mp, 1, size); - ucx_map_put(documents, ucx_key(&document, sizeof(void*)), ctx); + void *document = cxCalloc(a, 1, size); + cxMapPut(documents, cx_hash_key(&document, sizeof(void*)), ctx); return document; } @@ -95,7 +99,7 @@ UiContext* ui_document_context(void *doc) { if(doc) { - return ucx_map_get(documents, ucx_key(&doc, sizeof(void*))); + return cxMapGet(documents, cx_hash_key(&doc, sizeof(void*))); } else { return NULL; }