diff --git a/include/tlibc/collections/Array.h b/include/tlibc/collections/Array.h index 066cbaf..53022c9 100755 --- a/include/tlibc/collections/Array.h +++ b/include/tlibc/collections/Array.h @@ -37,6 +37,10 @@ static inline Array_ Array_copy(const Array_ self){ return copy; } +static inline void Array_free(Array_ self){ + free(self.data); +} + #define Array_len(SELF, T) (SELF.size / sizeof(T)) #define Array_memset(SELF, VAL) memset(SELF.data, VAL, SELF.size) diff --git a/include/tlibc/collections/List.h b/include/tlibc/collections/List.h index 6f26e3d..6f77de6 100755 --- a/include/tlibc/collections/List.h +++ b/include/tlibc/collections/List.h @@ -20,6 +20,10 @@ static inline List_ List_construct_size(void* data_ptr, u32 occupied_size, u32 a #define List_alloc(T, INITIAL_COUNT) List_alloc_size((INITIAL_COUNT) * sizeof(T)) List_ List_alloc_size(u32 initial_size); +static inline void List_destroy(List_ self){ + free(self.data); +} + List_ List_copy(List_ src); // alloc bigger buffer if size + size_to_add won't fit in current diff --git a/include/tlibc/string/str.h b/include/tlibc/string/str.h index 8b760c7..ec8af8d 100755 --- a/include/tlibc/string/str.h +++ b/include/tlibc/string/str.h @@ -22,7 +22,7 @@ static inline str str_from_cstr(cstr s_ptr){ return str_construct((void*)s_ptr, strlen(s_ptr), true); } -static inline void str_destroy(str s){ +static inline void str_free(str s){ free(s.data); }