Skip to content

Commit

Permalink
Support C23 projects
Browse files Browse the repository at this point in the history
Don't define true/false/bool when r3 is used by C23 projects
since C23 already has a bool type and predefined constants.
  • Loading branch information
bjosv committed Oct 2, 2023
1 parent 91405ad commit 255a594
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/r3.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <string.h>
#include <pcre.h>

#if __STDC_VERSION__ <= 201710L
#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
#elif !defined(bool) && !defined(__cplusplus)
Expand All @@ -20,6 +21,7 @@ typedef unsigned char bool;
# define false 0
# define true 1
#endif
#endif

#include "str_array.h"
#include "r3_slug.h"
Expand Down
2 changes: 2 additions & 0 deletions include/str_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "memory.h"

#if __STDC_VERSION__ <= 201710L
#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
#elif !defined(bool) && !defined(__cplusplus)
Expand All @@ -18,6 +19,7 @@ typedef unsigned char bool;
# define false 0
# define true 1
#endif
#endif

typedef struct _str_array {
R3_VECTOR(r3_iovec_t) slugs;
Expand Down
1 change: 0 additions & 1 deletion src/match_entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <string.h>
#include <pcre.h>
#include <assert.h>
#include <stdbool.h>

#include "r3.h"

Expand Down

0 comments on commit 255a594

Please sign in to comment.