fixed bug in Autoarr_toArray

This commit is contained in:
Timerix22 2023-05-19 18:42:08 +06:00
parent 26b69f9b7b
commit f4e666640e

View File

@ -64,6 +64,8 @@ void ____Autoarr_##type##_freeWithMembers(void* ar){ \
\ \
type* __Autoarr_##type##_toArray(Autoarr_##type* ar){ \ type* __Autoarr_##type##_toArray(Autoarr_##type* ar){ \
u32 length=Autoarr_length(ar); \ u32 length=Autoarr_length(ar); \
if(length==0) \
return NULL; \
type* array=malloc(length * sizeof(type)); \ type* array=malloc(length * sizeof(type)); \
for(u32 i=0; i<length; i++) \ for(u32 i=0; i<length; i++) \
array[i]=__Autoarr_##type##_get(ar, i); \ array[i]=__Autoarr_##type##_get(ar, i); \