ui/common/context.c

changeset 1016
ccde46662db7
parent 976
e2763e880938
--- a/ui/common/context.c	Wed Dec 17 18:31:20 2025 +0100
+++ b/ui/common/context.c	Thu Dec 18 17:50:15 2025 +0100
@@ -59,13 +59,14 @@
     memset(ctx, 0, sizeof(UiContext));
     ctx->mp = mp;
     ctx->allocator = mp->allocator;
-    ctx->destroy_handler = cxArrayListCreate(ctx->allocator, NULL, sizeof(UiDestroyHandler), 16);
+    ctx->destroy_handler = cxArrayListCreate(ctx->allocator, sizeof(UiDestroyHandler), 16);
     ctx->obj = toplevel;
     ctx->vars = cxHashMapCreate(mp->allocator, CX_STORE_POINTERS, 16);
     
-    ctx->documents = cxLinkedListCreate(mp->allocator, cx_cmp_ptr, CX_STORE_POINTERS);
-    ctx->state_widgets = cxLinkedListCreate(mp->allocator, cx_cmp_ptr, sizeof(UiStateWidget));
-    ctx->states = cxArrayListCreate(mp->allocator, cx_cmp_int, sizeof(int), 32);
+    ctx->documents = cxLinkedListCreate(mp->allocator, CX_STORE_POINTERS);
+    ctx->state_widgets = cxLinkedListCreate(mp->allocator, sizeof(UiStateWidget));
+    ctx->states = cxArrayListCreate(mp->allocator, sizeof(int), 32);
+    cxSetCompareFunc(ctx->states, cx_cmp_int);
     
     ctx->attach_document = uic_context_attach_document;
     ctx->detach_document2 = uic_context_detach_document;
@@ -173,7 +174,7 @@
 
 void uic_context_detach_all(UiContext *ctx) {
     // copy list
-    CxList *ls = cxLinkedListCreate(cxDefaultAllocator, NULL, CX_STORE_POINTERS);
+    CxList *ls = cxLinkedListCreate(cxDefaultAllocator, CX_STORE_POINTERS);
     CxIterator i = cxListIterator(ctx->documents);
     cx_foreach(void *, doc, i) {
         cxListAdd(ls, doc);
@@ -590,7 +591,7 @@
         enable = (ui_enablefunc)ui_set_enabled;
     }
     // get states
-    CxList *states = cxArrayListCreate(cxDefaultAllocator, NULL, sizeof(int), 16);
+    CxList *states = cxArrayListCreate(cxDefaultAllocator, sizeof(int), 16);
     va_list ap;
     va_start(ap, enable);
     int state;
@@ -608,7 +609,7 @@
     if(enable == NULL) {
         enable = (ui_enablefunc)ui_set_enabled;
     }
-    CxList *ls = cxArrayListCreate(cxDefaultAllocator, NULL, sizeof(int), nstates);
+    CxList *ls = cxArrayListCreate(cxDefaultAllocator, sizeof(int), nstates);
     for(int i=0;i<nstates;i++) {
         cxListAdd(ls, states+i);
     }

mercurial