diff --git a/include/tlibc/collections/Array.h b/include/tlibc/collections/Array.h index 6b433a0..37814dd 100755 --- a/include/tlibc/collections/Array.h +++ b/include/tlibc/collections/Array.h @@ -33,8 +33,8 @@ static inline Array_ Array_copy(Array_ src){ return copy; } -#define Array_len(AR, T) ((AR)->size / sizeof(T)) -#define Array_memset(A, VAL) memset((A)->data, VAL, (A)->size) +#define Array_len(A, T) (A.size / sizeof(T)) +#define Array_memset(A, VAL) memset(A.data, VAL, A.size) #define struct_castTo_Array(STRUCT_PTR) Array_construct_size((STRUCT_PTR), sizeof(*STRUCT_PTR)) diff --git a/include/tlibc/filesystem.h b/include/tlibc/filesystem.h index 6bd57fe..5c0a00c 100644 --- a/include/tlibc/filesystem.h +++ b/include/tlibc/filesystem.h @@ -58,6 +58,10 @@ str path_basename(str path, bool remove_ext); Result(FILE*) file_open(cstr file_name, cstr fopen_mode); +static inline void file_close(FILE* f){ + fclose(f); +} + /// if file exists, opens it with "rb+", else creates it with "wb+" Result(FILE*) file_openOrCreateReadWrite(cstr file_name);