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.
This commit is contained in:
Björn Svensson 2021-10-12 11:18:45 +02:00
parent 0072b618b6
commit 4babe735e8
2 changed files with 14 additions and 15 deletions

View file

@ -13,23 +13,14 @@
#include <pcre.h> #include <pcre.h>
#ifdef HAVE_STDBOOL_H #ifdef HAVE_STDBOOL_H
# include <stdbool.h>
#include <stdbool.h> #elif !defined(bool) && !defined(__cplusplus)
#else
#if !defined(bool) && !defined(__cplusplus)
typedef unsigned char bool; typedef unsigned char bool;
#endif # define bool bool /* For redefinition guards */
#ifndef false
# define false 0 # define false 0
#endif
#ifndef true
# define true 1 # define true 1
#endif #endif
#endif
#include "str_array.h" #include "str_array.h"
#include "r3_slug.h" #include "r3_slug.h"
#include "memory.h" #include "memory.h"

View file

@ -8,9 +8,17 @@
#ifndef STR_ARRAY_H #ifndef STR_ARRAY_H
#define STR_ARRAY_H #define STR_ARRAY_H
#include "r3.h"
#include "memory.h" #include "memory.h"
#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
#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 { typedef struct _str_array {
R3_VECTOR(r3_iovec_t) slugs; R3_VECTOR(r3_iovec_t) slugs;
R3_VECTOR(r3_iovec_t) tokens; R3_VECTOR(r3_iovec_t) tokens;