From 84ba41e180b8bd175f489e2750b59ced99d261dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorben=20H=C3=B6hne?= Date: Sun, 29 Jun 2025 15:07:31 +0200 Subject: [PATCH] fix: Adding Header guards. --- include/list.h | 5 ++ include/set.h | 117 +++++++++++++++++++++++------------------- include/set_asserts.h | 4 +- include/utils.h | 5 ++ 4 files changed, 75 insertions(+), 56 deletions(-) diff --git a/include/list.h b/include/list.h index eb2605d..f2427fb 100644 --- a/include/list.h +++ b/include/list.h @@ -1,3 +1,6 @@ +#ifndef INCLUDE_SET_LIST_ +#define INCLUDE_SET_LIST_ + #include struct SETBlockMeta @@ -31,3 +34,5 @@ void set_ll_free_all(struct SETBlockMeta *head); */ struct SETBlockMeta *set_ll_free_one(struct SETBlockMeta *head, void *address); + +#endif diff --git a/include/set.h b/include/set.h index 1a1b69f..044e342 100644 --- a/include/set.h +++ b/include/set.h @@ -2,6 +2,11 @@ #define _GNU_SOURCE #endif +#ifdef __cplusplus +extern "C" +{ +#endif + #include #include #include @@ -18,66 +23,66 @@ #ifndef INCLUDE_SET_H #define INCLUDE_SET_H -/** - * Meta data for one test function. - * - * See also: struct SETSuit - */ -struct SETest -{ - void (*function)(struct SETest *test); - const char *error_msg; - const char *name; - bool passed; -}; + /** + * Meta data for one test function. + * + * See also: struct SETSuit + */ + struct SETest + { + void (*function)(struct SETest *test); + const char *error_msg; + const char *name; + bool passed; + }; -/** - * Meta data for one test suit. - * - * See also: struct SETest - */ -struct SETSuit -{ - const char *name; - struct SETest *tests; - int len; - int shm_key; - bool (*setup)(); - bool (*tear_down)(); - bool passed; -}; + /** + * Meta data for one test suit. + * + * See also: struct SETest + */ + struct SETSuit + { + const char *name; + struct SETest *tests; + int len; + int shm_key; + bool (*setup)(); + bool (*tear_down)(); + bool passed; + }; -/** - * Internal function header for bundle. Use BUNDLE() macro to define bundle in - * test. - */ -void set_bundle_suits(struct SETSuit **suits, int *counter, bool count); + /** + * Internal function header for bundle. Use BUNDLE() macro to define bundle + * in test. + */ + void set_bundle_suits(struct SETSuit **suits, int *counter, bool count); -/** - * Empty suit_setup. Resolving EMPTY in a suit constructor gets - * us here. - * - * Note: Use EMPTY instead of this function. - */ -static bool EMPTY_suit_setup() { return true; } + /** + * Empty suit_setup. Resolving EMPTY in a suit constructor gets + * us here. + * + * Note: Use EMPTY instead of this function. + */ + static bool EMPTY_suit_setup() { return true; } -/** - * Empty suit_tear_down. Resolving EMPTY in a suit constructor gets - * us here. - * - * Note: Use EMPTY instead of this function. - */ -static bool EMPTY_suit_tear_down() { return true; } + /** + * Empty suit_tear_down. Resolving EMPTY in a suit constructor gets + * us here. + * + * Note: Use EMPTY instead of this function. + */ + static bool EMPTY_suit_tear_down() { return true; } -/** - * Internal header for global setup. Use SETUP() macro instead. - */ -bool set_up(); + /** + * Internal header for global setup. Use SETUP() macro instead. + */ + bool set_up(); -/** - * Internal header for global tear down. Use TEAR_DOWN() macro instead. - */ -bool tear_down(); + /** + * Internal header for global tear down. Use TEAR_DOWN() macro instead. + */ + bool tear_down(); /** * Global setup function. @@ -246,3 +251,7 @@ bool tear_down(); void test_name##_test(struct SETest *test) #endif // !INCLUDE_SET_H + +#ifdef __cplusplus +} +#endif diff --git a/include/set_asserts.h b/include/set_asserts.h index 32d9209..58f1926 100644 --- a/include/set_asserts.h +++ b/include/set_asserts.h @@ -3,8 +3,8 @@ #include "set.h" -#ifndef ASSERT_H -#define ASSERT_H +#ifndef INCLUDE_SET_ASSERT_H +#define INCLUDE_SET_ASSERT_H #define STATIC_ASSERT(condition) (void)sizeof(char[1 - 2 * (!(condition))]) diff --git a/include/utils.h b/include/utils.h index 36613a3..2449da5 100644 --- a/include/utils.h +++ b/include/utils.h @@ -1,5 +1,8 @@ #include +#ifndef INCLUDE_SET_UTILS_H_ +#define INCLUDE_SET_UTILS_H_ + /* * Returns pointer to formatted the string. * @@ -52,3 +55,5 @@ void *set_calloc(size_t n, size_t size); * See also: set_malloc() */ void *set_realloc(size_t n); + +#endif