diff --git a/src/Autoarr/Autoarr.c b/src/Autoarr/Autoarr.c index f2159c8..abc9e53 100644 --- a/src/Autoarr/Autoarr.c +++ b/src/Autoarr/Autoarr.c @@ -1,17 +1,17 @@ #include "Autoarr.h" -Autoarr_define(Pointer, true) -Autoarr_define(char, false) -Autoarr_define(bool, false) -Autoarr_define(f32, false) -Autoarr_define(f64, false) -Autoarr_define(u8, false) -Autoarr_define(i8, false) -Autoarr_define(u16, false) -Autoarr_define(i16, false) -Autoarr_define(u32, false) -Autoarr_define(i32, false) -Autoarr_define(u64, false) -Autoarr_define(i64, false) +Autoarr_define(Pointer) +Autoarr_define(char) +Autoarr_define(bool) +Autoarr_define(f32) +Autoarr_define(f64) +Autoarr_define(u8) +Autoarr_define(i8) +Autoarr_define(u16) +Autoarr_define(i16) +Autoarr_define(u32) +Autoarr_define(i32) +Autoarr_define(u64) +Autoarr_define(i64) -Autoarr_define(Unitype, false) +Autoarr_define(Unitype) diff --git a/src/Autoarr/Autoarr_define.h b/src/Autoarr/Autoarr_define.h index cf5a1b3..83df798 100644 --- a/src/Autoarr/Autoarr_define.h +++ b/src/Autoarr/Autoarr_define.h @@ -6,7 +6,7 @@ extern "C" { #include "../base/base.h" -#define Autoarr_define(TYPE, TYPE_IS_PTR) \ +#define Autoarr_define(TYPE) \ \ void __Autoarr_##TYPE##_add(Autoarr_##TYPE* ar, TYPE element){ \ TYPE* ptr = allocator_alloc(InternalAllocator_getPtr(ar), sizeof(element)); \ @@ -42,13 +42,6 @@ void __Autoarr_##TYPE##_set(Autoarr_##TYPE* ar, u32 index, TYPE value){ \ } \ \ void __Autoarr_##TYPE##_destruct(Autoarr_##TYPE* ar){ \ - destruct_t value_destructor=ar->type->destruct; \ - if(value_destructor!=NULL) { \ - Autoarr_foreach(ar, el, \ - TYPE* value_ptr = TYPE_IS_PTR ? *(TYPE**)(&el) : ⪙ \ - value_destructor(value_ptr); \ - ); \ - } \ InternalAllocator_destructIfInternal(LinearAllocator, ar); \ } \ \ @@ -74,7 +67,7 @@ __Autoarr_##TYPE##_functions_list_t __Autoarr_##TYPE##_functions_list={ \ void __Autoarr_##TYPE##_construct(Autoarr_##TYPE* ar, alloc_size_t starting_size, allocator_ptr data_allocator){ \ InternalAllocator_setExternalOrConstruct(ar, data_allocator, LinearAllocator, starting_size); \ ar->functions=&__Autoarr_##TYPE##_functions_list; \ - ar->type = TYPE_IS_PTR ? &ktDescriptor_namePtr(TYPE) : &ktDescriptor_name(TYPE); \ + ar->type = &ktDescriptor_name(TYPE); \ ar->length=0; \ } \ \ diff --git a/src/String/string.c b/src/String/string.c index 676bb43..744b15f 100644 --- a/src/String/string.c +++ b/src/String/string.c @@ -1,7 +1,7 @@ #include "string.h" kt_define(string, NULL, NULL); -Autoarr_define(string, false); +Autoarr_define(string); // copies str content to new char pointer value (adding '\0' at the end) char* string_extract(allocator_ptr al, string str){