Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

Commit

Permalink
fix compile error "<strings.h> does not exist" on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
cuong.nguyen authored and cuongkjm committed Feb 25, 2022
1 parent aa91b27 commit f0ea1d2
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/attribute.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "string_util.h"

#include "util.h"

Expand Down
2 changes: 1 addition & 1 deletion src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "string_util.h"

#include "attribute.h"
#include "error.h"
Expand Down
2 changes: 1 addition & 1 deletion src/string_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "string_util.h"

#include "string_piece.h"
#include "util.h"
Expand Down
2 changes: 1 addition & 1 deletion src/string_piece.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "string_util.h"

#include "util.h"

Expand Down
11 changes: 11 additions & 0 deletions src/string_util.h
Original file line number Diff line number Diff line change
@@ -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 <strings.h>
#endif

#endif // STRING_UTIL_H
2 changes: 1 addition & 1 deletion src/utf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <assert.h>
#include <stdint.h>
#include <string.h>
#include <strings.h> // For strncasecmp.
#include "string_util.h" // For strncasecmp.

#include "error.h"
#include "gumbo.h"
Expand Down
2 changes: 1 addition & 1 deletion src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "string_util.h"
#include <stdarg.h>
#include <stdio.h>

Expand Down
2 changes: 1 addition & 1 deletion src/vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "string_util.h"

#include "util.h"

Expand Down

0 comments on commit f0ea1d2

Please sign in to comment.