apply new formatting rules to project

This commit is contained in:
2025-03-21 16:46:03 +01:00
parent 42855bbf72
commit 4d31834178
2 changed files with 26 additions and 26 deletions

View File

@@ -1,28 +1,28 @@
#ifndef DYNARR_H #ifndef DYNARR_H
#define DYNARR_H # define DYNARR_H
#include <stddef.h> # include <stddef.h>
#define DYNARR_COMB2(a, b) a##b # define DYNARR_COMB2(a, b) a##b
#define DYNARR_COMB1(a, b) DYNARR_COMB2(a, b) # define DYNARR_COMB1(a, b) DYNARR_COMB2(a, b)
#endif // DYNARR_H #endif // DYNARR_H
#ifdef DYNARR_TYPE #ifdef DYNARR_TYPE
#include <stdint.h> # include <stdint.h>
#include <stdlib.h> # include <stdlib.h>
#include <string.h> # include <string.h>
// customising the linkage // customising the linkage
#ifndef DYNARR_LINKAGE # ifndef DYNARR_LINKAGE
#define DYNARR_LINKAGE static inline # define DYNARR_LINKAGE static inline
#endif # endif
// customising the name // customising the name
#ifndef DYNARR_NAME # ifndef DYNARR_NAME
#define DYNARR_NAME DYNARR_COMB1(dynarr_, DYNARR_TYPE) # define DYNARR_NAME DYNARR_COMB1(dynarr_, DYNARR_TYPE)
#endif // DYNARR_NAME # endif // DYNARR_NAME
#define DYNARR_COUNT_MAX (SIZE_MAX / sizeof(DYNARR_TYPE)) # define DYNARR_COUNT_MAX (SIZE_MAX / sizeof(DYNARR_TYPE))
#define DYNARR_FUNC(name) DYNARR_COMB1(DYNARR_NAME, _##name) // name of the initialization funcition # define DYNARR_FUNC(name) DYNARR_COMB1(DYNARR_NAME, _##name) // name of the initialization funcition
// define the dynamic array structure // define the dynamic array structure
typedef struct { typedef struct {
@@ -166,11 +166,11 @@ DYNARR_LINKAGE uint8_t DYNARR_FUNC(remove)(DYNARR_NAME* arr, size_t idx) {
} }
// clean up all defined definitions so they can be used again later // clean up all defined definitions so they can be used again later
#undef DYNARR_COUNT_MAX # undef DYNARR_COUNT_MAX
#undef DYNARR_FUNC # undef DYNARR_FUNC
#undef DYNARR_NAME # undef DYNARR_NAME
#undef DYNARR_LINKAGE # undef DYNARR_LINKAGE
#undef DYNARR_TYPE # undef DYNARR_TYPE
#elif __INCLUDE_LEVEL__ != 0 #elif __INCLUDE_LEVEL__ != 0
#error define DYNARR_TYPE before including # error define DYNARR_TYPE before including
#endif // DYNARR_TYPE #endif // DYNARR_TYPE

View File

@@ -8,13 +8,13 @@
#include <string.h> #include <string.h>
#ifdef __unix__ #ifdef __unix__
#include <unistd.h> # include <unistd.h>
#define fexists(fname) (access(fname, F_OK) == 0) # define fexists(fname) (access(fname, F_OK) == 0)
#elif _WIN32 #elif _WIN32
#include <io.h> # include <io.h>
#define fexists(fname) (_access(fname, 0) == 0) # define fexists(fname) (_access(fname, 0) == 0)
#else #else
#error platform not supported! # error platform not supported!
#endif #endif
#include "../error.h" #include "../error.h"