Replace guards with pragma once

This commit is contained in:
Krzosa Karol
2023-12-31 10:30:34 +01:00
parent 1569f94374
commit 4ef1cb7250
14 changed files with 25 additions and 56 deletions

10
arena.h
View File

@@ -9,6 +9,11 @@
#define MA_GIB(x) (MA_MIB(x) * 1024ull) #define MA_GIB(x) (MA_MIB(x) * 1024ull)
#define MA_TIB(x) (MA_GIB(x) * 1024ull) #define MA_TIB(x) (MA_GIB(x) * 1024ull)
typedef struct MV_Memory MV_Memory;
typedef struct MA_Checkpoint MA_Checkpoint;
typedef struct MA_Arena MA_Arena;
typedef struct M_Allocator M_Allocator;
#ifndef MA_DEFAULT_RESERVE_SIZE #ifndef MA_DEFAULT_RESERVE_SIZE
#define MA_DEFAULT_RESERVE_SIZE MA_GIB(1) #define MA_DEFAULT_RESERVE_SIZE MA_GIB(1)
#endif #endif
@@ -69,12 +74,7 @@ typedef enum M_AllocatorOp {
M_AllocatorOp_Deallocate, M_AllocatorOp_Deallocate,
} M_AllocatorOp; } M_AllocatorOp;
typedef struct MV_Memory MV_Memory;
typedef struct MA_Checkpoint MA_Checkpoint;
typedef struct MA_Arena MA_Arena;
typedef struct M_Allocator M_Allocator;
typedef void *M_AllocatorProc(void *allocator, M_AllocatorOp kind, void *p, size_t size); typedef void *M_AllocatorProc(void *allocator, M_AllocatorOp kind, void *p, size_t size);
struct M_Allocator { struct M_Allocator {
void *obj; void *obj;
void *(*p)(void *allocator, M_AllocatorOp kind, void *p, size_t size); void *(*p)(void *allocator, M_AllocatorOp kind, void *p, size_t size);

View File

@@ -1,4 +1,4 @@
// #define ARRAY_ALLOCATOR_TYPE Allocator #pragma once
#ifndef ARRAY_PRIVATE_FUNCTION #ifndef ARRAY_PRIVATE_FUNCTION
#if defined(__GNUC__) || defined(__clang__) #if defined(__GNUC__) || defined(__clang__)

View File

@@ -1,5 +1,4 @@
#ifndef CL_HEADER #pragma once
#define CL_HEADER
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>
@@ -494,5 +493,3 @@ CL_INLINE CL_Token *CL_MatchIdentifier(CL_Tokens *tokens, char *str) {
} }
return 0; return 0;
} }
#endif // CL_HEADER

View File

@@ -1,5 +1,4 @@
#ifndef OS_FS_HEADER #pragma once
#define OS_FS_HEADER
#ifndef OS_API #ifndef OS_API
#ifdef __cplusplus #ifdef __cplusplus
@@ -63,4 +62,3 @@ OS_API S8_String OS_ListDirRegexAsString(MA_Arena *arena, S8_String path, unsign
OS_API bool OS_ExpandIncludesList(MA_Arena *arena, S8_List *out, S8_String filepath); OS_API bool OS_ExpandIncludesList(MA_Arena *arena, S8_List *out, S8_String filepath);
OS_API S8_String OS_ExpandIncludes(MA_Arena *arena, S8_String filepath); OS_API S8_String OS_ExpandIncludes(MA_Arena *arena, S8_String filepath);
OS_API bool WIN_EnableTerminalColors(void); OS_API bool WIN_EnableTerminalColors(void);
#endif // OS_FS_HEADER

18
hash.h
View File

@@ -1,5 +1,4 @@
#ifndef HASH_HEADER #pragma once
#define HASH_HEADER
#include <stdint.h> #include <stdint.h>
#ifndef HASH_API_FUNCTION #ifndef HASH_API_FUNCTION
@@ -19,15 +18,14 @@ struct RandomSeed {
}; };
//@begin gen_api_funcs //@begin gen_api_funcs
HASH_API_FUNCTION uint64_t HashBytes(void *data, uint64_t size); HASH_API_FUNCTION uint64_t HashBytes(void *data, uint64_t size);
HASH_API_FUNCTION RandomSeed MakeRandomSeed(uint64_t value); HASH_API_FUNCTION RandomSeed MakeRandomSeed(uint64_t value);
HASH_API_FUNCTION uint64_t GetRandomU64(RandomSeed *state); HASH_API_FUNCTION uint64_t GetRandomU64(RandomSeed *state);
HASH_API_FUNCTION int GetRandomRangeI(RandomSeed *seed, int first, int last_included); HASH_API_FUNCTION int GetRandomRangeI(RandomSeed *seed, int first, int last_included);
HASH_API_FUNCTION double GetRandomNormal(RandomSeed *series); HASH_API_FUNCTION double GetRandomNormal(RandomSeed *series);
HASH_API_FUNCTION double GetRandomNormalRange(RandomSeed *seed, double min, double max); HASH_API_FUNCTION double GetRandomNormalRange(RandomSeed *seed, double min, double max);
HASH_API_FUNCTION uint64_t HashMix(uint64_t x, uint64_t y); HASH_API_FUNCTION uint64_t HashMix(uint64_t x, uint64_t y);
//@end gen_api_funcs //@end gen_api_funcs
#define WRAP_AROUND_POWER_OF_2(x, pow2) (((x) & ((pow2)-1llu))) #define WRAP_AROUND_POWER_OF_2(x, pow2) (((x) & ((pow2)-1llu)))
static inline float GetRandomNormalF(RandomSeed *series) { return (float)GetRandomNormal(series); } static inline float GetRandomNormalF(RandomSeed *series) { return (float)GetRandomNormal(series); }
#endif

4
io.h
View File

@@ -1,5 +1,4 @@
#ifndef IO_HEADER #pragma once
#define IO_HEADER
#include <stdbool.h> #include <stdbool.h>
#ifndef IO_API #ifndef IO_API
@@ -72,4 +71,3 @@ IO_API void IO_OutputMessage(char *str, int len);
IO_API IO_ErrorResult IO_OutputError(char *str, int len); IO_API IO_ErrorResult IO_OutputError(char *str, int len);
IO_API void IO_Exit(int error_code); IO_API void IO_Exit(int error_code);
IO_API bool IO_IsDebuggerPresent(void); IO_API bool IO_IsDebuggerPresent(void);
#endif

View File

@@ -1,6 +1,4 @@
#ifndef LINKED_LIST_HEADER #pragma once
#define LINKED_LIST_HEADER
#define SLL_QUEUE_ADD_MOD(f, l, n, next) \ #define SLL_QUEUE_ADD_MOD(f, l, n, next) \
do { \ do { \
(n)->next = 0; \ (n)->next = 0; \
@@ -125,5 +123,3 @@
} while (0) } while (0)
#define DLL_INSERT_NEXT(base, new) DLL_INSERT_NEXT_MOD(base, new, next, prev) #define DLL_INSERT_NEXT(base, new) DLL_INSERT_NEXT_MOD(base, new, next, prev)
#define DLL_INSERT_PREV(base, new) DLL_INSERT_NEXT_MOD(base, new, next, prev) #define DLL_INSERT_PREV(base, new) DLL_INSERT_NEXT_MOD(base, new, next, prev)
#endif

View File

@@ -1,6 +1,4 @@
#ifndef LIB_LOAD_HEADER #pragma once
#define LIB_LOAD_HEADER
typedef void *LIB_Library; typedef void *LIB_Library;
LIB_Library LIB_LoadLibrary(char *str); LIB_Library LIB_LoadLibrary(char *str);
@@ -10,5 +8,3 @@ bool LIB_UnloadLibrary(LIB_Library lib);
#ifndef LIB_EXPORT #ifndef LIB_EXPORT
#define LIB_EXPORT __declspec(dllexport) #define LIB_EXPORT __declspec(dllexport)
#endif #endif
#endif

View File

@@ -1,5 +1,4 @@
#ifndef MU_HEADER #pragma once
#define MU_HEADER
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
@@ -367,5 +366,3 @@ typedef struct MU_Event {
*/ */
#endif // MU_HEADER

View File

@@ -1,6 +1,4 @@
#ifndef PREPROC_ENV_HEADER #pragma once
#define PREPROC_ENV_HEADER
#ifndef _CRT_SECURE_NO_WARNINGS #ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS
#endif #endif
@@ -86,5 +84,3 @@
// #pragma clang diagnostic push // #pragma clang diagnostic push
// #pragma clang diagnostic ignored "-Wmicrosoft-enum-forward-reference" // #pragma clang diagnostic ignored "-Wmicrosoft-enum-forward-reference"
// #endif // #endif
#endif // PREPROC_ENV_HEADER

View File

@@ -1,5 +1,4 @@
#ifndef RE_HEADER #pragma once
#define RE_HEADER
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
@@ -92,5 +91,3 @@ RE_API RE_Match RE3_FindAgain(RE_Regex *regex, char *string, RE_Int len, RE_Matc
RE_API RE_Int RE3_MatchFront(RE_Regex *regex, char *string, RE_Int len, char *string_front); RE_API RE_Int RE3_MatchFront(RE_Regex *regex, char *string, RE_Int len, char *string_front);
RE_API RE_Regex *RE1_Parse(char *buff, RE_Int buffsize, char *string); RE_API RE_Regex *RE1_Parse(char *buff, RE_Int buffsize, char *string);
RE_API RE_Regex *RE2_Parse(char *buff, RE_Int buffsize, char *string, RE_Int len); RE_API RE_Regex *RE2_Parse(char *buff, RE_Int buffsize, char *string, RE_Int len);
#endif // RE_HEADER

View File

@@ -1,5 +1,4 @@
#ifndef S8_HEADER #pragma once
#define S8_HEADER
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
@@ -115,5 +114,3 @@ S8_API S8_List S8_CopyList(S8_Allocator allocator, S8_List a);
S8_API S8_List S8_ConcatLists(S8_Allocator allocator, S8_List a, S8_List b); S8_API S8_List S8_ConcatLists(S8_Allocator allocator, S8_List a, S8_List b);
S8_API S8_Node *S8_AddNode(S8_Allocator allocator, S8_List *list, S8_String string); S8_API S8_Node *S8_AddNode(S8_Allocator allocator, S8_List *list, S8_String string);
S8_API S8_String S8_AddF(S8_Allocator allocator, S8_List *list, const char *str, ...); S8_API S8_String S8_AddF(S8_Allocator allocator, S8_List *list, const char *str, ...);
#endif // S8_HEADER

View File

@@ -1,3 +1,4 @@
#pragma once
#include <stdint.h> #include <stdint.h>
/* /*
Hash table implementation: Hash table implementation:

View File

@@ -1,5 +1,4 @@
#ifndef UTF_HEADER #pragma once
#define UTF_HEADER
#include <stdint.h> #include <stdint.h>
typedef struct UTF32_Result UTF32_Result; typedef struct UTF32_Result UTF32_Result;
typedef struct UTF8_Result UTF8_Result; typedef struct UTF8_Result UTF8_Result;
@@ -51,4 +50,3 @@ UTF_API UTF8_Iter UTF8_IterateEx(char *str, int len);
UTF_API UTF8_Iter UTF8_Iterate(char *str); UTF_API UTF8_Iter UTF8_Iterate(char *str);
#define UTF8_For(name, str, len) for (UTF8_Iter name = UTF8_IterateEx(str, (int)len); name.item; UTF8_Advance(&name)) #define UTF8_For(name, str, len) for (UTF8_Iter name = UTF8_IterateEx(str, (int)len); name.item; UTF8_Advance(&name))
#endif // UTF_HEADER