aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorK.Kosako <kosako@sofnec.co.jp>2020-01-14 15:08:58 +0900
committerK.Kosako <kosako@sofnec.co.jp>2020-01-14 15:08:58 +0900
commitc0457e97817f92c83a3a3ed07915e1d1dc2b16c6 (patch)
treef7244ac1c4b0a1f6c946e1af865e0a3e91cae3dd
parent71962a8332d5aadbb445722acdf30f5a7990f2fd (diff)
downloadoniguruma-c0457e97817f92c83a3a3ed07915e1d1dc2b16c6.zip
oniguruma-c0457e97817f92c83a3a3ed07915e1d1dc2b16c6.tar.gz
oniguruma-c0457e97817f92c83a3a3ed07915e1d1dc2b16c6.tar.bz2
remove direct include stdio.h by using NEED_TO_INCLUDE_STDIO
-rw-r--r--src/regerror.c8
-rw-r--r--src/regexec.c9
-rw-r--r--src/regint.h7
-rw-r--r--src/regparse.c10
-rw-r--r--src/regversion.c7
-rw-r--r--src/st.c11
6 files changed, 34 insertions, 18 deletions
diff --git a/src/regerror.c b/src/regerror.c
index 7c0cc24..529a222 100644
--- a/src/regerror.c
+++ b/src/regerror.c
@@ -2,7 +2,7 @@
regerror.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2019 K.Kosako
+ * Copyright (c) 2002-2020 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,8 +27,12 @@
* SUCH DAMAGE.
*/
+#ifndef NEED_TO_INCLUDE_STDIO
+/* for vsnprintf() */
+#define NEED_TO_INCLUDE_STDIO
+#endif
+
#include "regint.h"
-#include <stdio.h> /* for vsnprintf() */
#include <stdarg.h>
diff --git a/src/regexec.c b/src/regexec.c
index 7d5b817..31ff986 100644
--- a/src/regexec.c
+++ b/src/regexec.c
@@ -26,6 +26,13 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+
+#ifndef ONIGURUMA_UNSUPPORTED_PRINT
+#ifndef NEED_TO_INCLUDE_STDIO
+#define NEED_TO_INCLUDE_STDIO
+#endif
+#endif
+
#include "regint.h"
#define IS_MBC_WORD_ASCII_MODE(enc,s,end,mode) \
@@ -6250,8 +6257,6 @@ onig_builtin_cmp(OnigCalloutArgs* args, void* user_data ARG_UNUSED)
#ifndef ONIGURUMA_UNSUPPORTED_PRINT
-#include <stdio.h>
-
static FILE* OutFp;
/* name start with "onig_" for macros. */
diff --git a/src/regint.h b/src/regint.h
index c8b54db..48e4d81 100644
--- a/src/regint.h
+++ b/src/regint.h
@@ -119,12 +119,13 @@
#include <malloc.h>
#endif
-#endif /* ONIGURUMA_SYS_UEFI */
-
-#ifdef ONIG_DEBUG
+#if defined(ONIG_DEBUG) || defined(NEED_TO_INCLUDE_STDIO)
# include <stdio.h>
#endif
+#endif /* ONIGURUMA_SYS_UEFI */
+
+
#ifdef MIN
#undef MIN
#endif
diff --git a/src/regparse.c b/src/regparse.c
index 7a884fe..cf5f9c0 100644
--- a/src/regparse.c
+++ b/src/regparse.c
@@ -27,13 +27,15 @@
* SUCH DAMAGE.
*/
-#include "regparse.h"
-#include "st.h"
-
#ifdef DEBUG_NODE_FREE
-#include <stdio.h>
+#ifndef NEED_TO_INCLUDE_STDIO
+#define NEED_TO_INCLUDE_STDIO
+#endif
#endif
+#include "regparse.h"
+#include "st.h"
+
#define INIT_TAG_NAMES_ALLOC_NUM 5
#define WARN_BUFSIZE 256
diff --git a/src/regversion.c b/src/regversion.c
index de993d3..1f0faa1 100644
--- a/src/regversion.c
+++ b/src/regversion.c
@@ -2,7 +2,7 @@
regversion.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2019 K.Kosako
+ * Copyright (c) 2002-2020 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,8 +27,11 @@
* SUCH DAMAGE.
*/
+#ifndef NEED_TO_INCLUDE_STDIO
+#define NEED_TO_INCLUDE_STDIO
+#endif
+
#include "regint.h"
-#include <stdio.h>
extern const char*
onig_version(void)
diff --git a/src/st.c b/src/st.c
index e5fd1a1..6a034fa 100644
--- a/src/st.c
+++ b/src/st.c
@@ -2,16 +2,17 @@
/* static char sccsid[] = "@(#) st.c 5.1 89/12/14 Crucible"; */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#ifndef NEED_TO_INCLUDE_STDIO
+#define NEED_TO_INCLUDE_STDIO
+#endif
+
+#include "regint.h"
+#include "st.h"
#ifdef _WIN32
#include <malloc.h>
#endif
-#include "regint.h"
-#include "st.h"
typedef struct st_table_entry st_table_entry;