changed Array_memset(), added file_close()

This commit is contained in:
Timerix 2025-11-06 22:25:11 +05:00
parent 5fb2db2380
commit 00a1a29d34
2 changed files with 6 additions and 2 deletions

View File

@ -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))

View File

@ -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);