src/array_list.c

changeset 667
2f88a7c13a28
parent 666
b5dd654deb3b
child 670
4ad8ea3aee49
     1.1 --- a/src/array_list.c	Mon Mar 20 19:09:08 2023 +0100
     1.2 +++ b/src/array_list.c	Tue Mar 21 17:18:29 2023 +0100
     1.3 @@ -516,9 +516,14 @@
     1.4      list->base.cl = &cx_array_list_class;
     1.5      list->base.allocator = allocator;
     1.6      list->base.cmpfunc = comparator;
     1.7 -    list->base.itemsize = item_size;
     1.8      list->base.capacity = initial_capacity;
     1.9  
    1.10 +    if (item_size > 0) {
    1.11 +        list->base.itemsize = item_size;
    1.12 +    } else {
    1.13 +        cxListStorePointers((CxList *) list);
    1.14 +    }
    1.15 +
    1.16      // configure the reallocator
    1.17      list->reallocator.realloc = cx_arl_realloc;
    1.18      list->reallocator.ptr1 = (void *) allocator;

mercurial