From 9ea57ba822c615d414715ecf3e9951d46c128b0a Mon Sep 17 00:00:00 2001 From: cuongkjm Date: Fri, 25 Feb 2022 18:49:22 +0700 Subject: [PATCH] fix compile error " does not exist" on Windows --- src/attribute.c | 2 +- src/parser.c | 2 +- src/string_buffer.c | 2 +- src/string_piece.c | 2 +- src/string_util.h | 11 +++++++++++ src/utf8.c | 2 +- src/util.c | 2 +- src/vector.c | 2 +- 8 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 src/string_util.h diff --git a/src/attribute.c b/src/attribute.c index 234927a5..501e842a 100644 --- a/src/attribute.c +++ b/src/attribute.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include "string_util.h" #include "util.h" diff --git a/src/parser.c b/src/parser.c index dc692b3e..d3a119d3 100644 --- a/src/parser.c +++ b/src/parser.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include "string_util.h" #include "attribute.h" #include "error.h" diff --git a/src/string_buffer.c b/src/string_buffer.c index d9be2f6b..06365d40 100644 --- a/src/string_buffer.c +++ b/src/string_buffer.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include "string_util.h" #include "string_piece.h" #include "util.h" diff --git a/src/string_piece.c b/src/string_piece.c index 8ad5b846..236674c2 100644 --- a/src/string_piece.c +++ b/src/string_piece.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include "string_util.h" #include "util.h" diff --git a/src/string_util.h b/src/string_util.h new file mode 100644 index 00000000..5655138b --- /dev/null +++ b/src/string_util.h @@ -0,0 +1,11 @@ +#ifndef STRING_UTIL_H +#define STRING_UTIL_H + +#if defined(_WIN32) || defined(_WIN64) +# define strcasecmp _stricmp +# define strncasecmp _strnicmp +#else +#include +#endif + +#endif // STRING_UTIL_H diff --git a/src/utf8.c b/src/utf8.c index fdd6f837..f6e3a598 100644 --- a/src/utf8.c +++ b/src/utf8.c @@ -19,7 +19,7 @@ #include #include #include -#include // For strncasecmp. +#include "string_util.h" // For strncasecmp. #include "error.h" #include "gumbo.h" diff --git a/src/util.c b/src/util.c index 5a24c115..c4c11911 100644 --- a/src/util.c +++ b/src/util.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include "string_util.h" #include #include diff --git a/src/vector.c b/src/vector.c index 51758dfe..97a152d3 100644 --- a/src/vector.c +++ b/src/vector.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include "string_util.h" #include "util.h"