From 4babe735e846dc5ca079864d74e15f552e203e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Svensson?= Date: Tue, 12 Oct 2021 11:18:45 +0200 Subject: [PATCH] Remove cyclic dependency between str_array.h and r3.h This also makes sure we dont get warnings regarding bool redefinitions when building with clang. --- include/r3.h | 19 +++++-------------- include/str_array.h | 10 +++++++++- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/include/r3.h b/include/r3.h index 0b6dde6..d2d226a 100644 --- a/include/r3.h +++ b/include/r3.h @@ -13,21 +13,12 @@ #include #ifdef HAVE_STDBOOL_H - -#include - -#else - -#if !defined(bool) && !defined(__cplusplus) +# include +#elif !defined(bool) && !defined(__cplusplus) typedef unsigned char bool; -#endif -#ifndef false -# define false 0 -#endif -#ifndef true -# define true 1 -#endif - +# define bool bool /* For redefinition guards */ +# define false 0 +# define true 1 #endif #include "str_array.h" diff --git a/include/str_array.h b/include/str_array.h index 778c807..b098436 100644 --- a/include/str_array.h +++ b/include/str_array.h @@ -8,9 +8,17 @@ #ifndef STR_ARRAY_H #define STR_ARRAY_H -#include "r3.h" #include "memory.h" +#ifdef HAVE_STDBOOL_H +# include +#elif !defined(bool) && !defined(__cplusplus) +typedef unsigned char bool; +# define bool bool /* For redefinition guards */ +# define false 0 +# define true 1 +#endif + typedef struct _str_array { R3_VECTOR(r3_iovec_t) slugs; R3_VECTOR(r3_iovec_t) tokens;