develop.uap-core.de/git
/
uwplayer.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
848befb
)
update ucx (array list fix)
author
Olaf Wintermann
<olaf.wintermann@gmail.com>
Fri, 7 Apr 2023 09:42:24 +0000
(11:42 +0200)
committer
Olaf Wintermann
<olaf.wintermann@gmail.com>
Fri, 7 Apr 2023 09:42:24 +0000
(11:42 +0200)
ucx/array_list.c
patch
|
blob
|
history
diff --git
a/ucx/array_list.c
b/ucx/array_list.c
index
fde5ecd
..
5c66d53
100644
(file)
--- a/
ucx/array_list.c
+++ b/
ucx/array_list.c
@@
-511,12
+511,6
@@
CxList *cxArrayListCreate(
cx_array_list *list = cxCalloc(allocator, 1, sizeof(cx_array_list));
if (list == NULL) return NULL;
cx_array_list *list = cxCalloc(allocator, 1, sizeof(cx_array_list));
if (list == NULL) return NULL;
- list->data = cxCalloc(allocator, initial_capacity, item_size);
- if (list->data == NULL) {
- cxFree(allocator, list);
- return NULL;
- }
-
list->base.cl = &cx_array_list_class;
list->base.allocator = allocator;
list->base.cmpfunc = comparator;
list->base.cl = &cx_array_list_class;
list->base.allocator = allocator;
list->base.cmpfunc = comparator;
@@
-525,9
+519,17
@@
CxList *cxArrayListCreate(
if (item_size > 0) {
list->base.itemsize = item_size;
} else {
if (item_size > 0) {
list->base.itemsize = item_size;
} else {
+ item_size = sizeof(void*);
cxListStorePointers((CxList *) list);
}
cxListStorePointers((CxList *) list);
}
+ // allocate the array after the real item_size is known
+ list->data = cxCalloc(allocator, initial_capacity, item_size);
+ if (list->data == NULL) {
+ cxFree(allocator, list);
+ return NULL;
+ }
+
// configure the reallocator
list->reallocator.realloc = cx_arl_realloc;
list->reallocator.ptr1 = (void *) allocator;
// configure the reallocator
list->reallocator.realloc = cx_arl_realloc;
list->reallocator.ptr1 = (void *) allocator;