| 1075 if (list == NULL) return NULL; |
1075 if (list == NULL) return NULL; |
| 1076 cx_list_init((CxList*)list, &cx_array_list_class, allocator, elem_size); |
1076 cx_list_init((CxList*)list, &cx_array_list_class, allocator, elem_size); |
| 1077 list->capacity = initial_capacity; |
1077 list->capacity = initial_capacity; |
| 1078 |
1078 |
| 1079 // allocate the array after the real elem_size is known |
1079 // allocate the array after the real elem_size is known |
| 1080 list->data = cxCalloc(allocator, initial_capacity, elem_size); |
1080 list->data = cxCalloc(allocator, initial_capacity, |
| |
1081 list->base.collection.elem_size); |
| 1081 if (list->data == NULL) { // LCOV_EXCL_START |
1082 if (list->data == NULL) { // LCOV_EXCL_START |
| 1082 cxFree(allocator, list); |
1083 cxFree(allocator, list); |
| 1083 return NULL; |
1084 return NULL; |
| 1084 } // LCOV_EXCL_STOP |
1085 } // LCOV_EXCL_STOP |
| 1085 |
1086 |