summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/array.c11
-rw-r--r--src/gc.c10
-rw-r--r--src/load.c6
-rw-r--r--src/string.c7
4 files changed, 24 insertions, 10 deletions
diff --git a/src/array.c b/src/array.c
index c6f2d8001..88f56f6b4 100644
--- a/src/array.c
+++ b/src/array.c
@@ -4,17 +4,18 @@
** See Copyright Notice in mruby.h
*/
+#ifndef SIZE_MAX
+ /* Some versions of VC++
+ * has SIZE_MAX in stdint.h
+ */
+# include <limits.h>
+#endif
#include "mruby.h"
#include "mruby/array.h"
#include "mruby/class.h"
#include "mruby/string.h"
#include "value_array.h"
-/* SIZE_MAX is not supported by VC++. */
-#ifndef SIZE_MAX
-# define SIZE_MAX ((size_t)-1)
-#endif
-
#define ARY_DEFAULT_LEN 4
#define ARY_SHRINK_RATIO 5 /* must be larger than 2 */
#define ARY_C_MAX_SIZE (SIZE_MAX / sizeof(mrb_value))
diff --git a/src/gc.c b/src/gc.c
index 0877c6c3c..c90e00c89 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -4,6 +4,12 @@
** See Copyright Notice in mruby.h
*/
+#ifndef SIZE_MAX
+ /* Some versions of VC++
+ * has SIZE_MAX in stdint.h
+ */
+# include <limits.h>
+#endif
#include <string.h>
#include "mruby.h"
#include "mruby/array.h"
@@ -15,10 +21,6 @@
#include "mruby/string.h"
#include "mruby/variable.h"
-#ifndef SIZE_MAX
-#include <limits.h> // for SIZE_MAX
-#endif
-
/*
= Tri-color Incremental Garbage Collection
diff --git a/src/load.c b/src/load.c
index 31c7153d6..63d829988 100644
--- a/src/load.c
+++ b/src/load.c
@@ -4,6 +4,12 @@
** See Copyright Notice in mruby.h
*/
+#ifndef SIZE_MAX
+ /* Some versions of VC++
+ * has SIZE_MAX in stdint.h
+ */
+# include <limits.h>
+#endif
#include <stdlib.h>
#include <string.h>
#include "mruby/dump.h"
diff --git a/src/string.c b/src/string.c
index e5e03d27c..3b57edf54 100644
--- a/src/string.c
+++ b/src/string.c
@@ -5,7 +5,12 @@
*/
#include <ctype.h>
-#include <limits.h>
+#ifndef SIZE_MAX
+ /* Some versions of VC++
+ * has SIZE_MAX in stdint.h
+ */
+# include <limits.h>
+#endif
#include <stddef.h>
#include <stdlib.h>
#include <string.h>