summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/array.c7
-rw-r--r--src/class.c2
-rw-r--r--src/gc.c13
-rw-r--r--src/load.c7
-rw-r--r--src/numeric.c6
-rw-r--r--src/string.c7
6 files changed, 9 insertions, 33 deletions
diff --git a/src/array.c b/src/array.c
index 0fb257d7e..f9097baa7 100644
--- a/src/array.c
+++ b/src/array.c
@@ -4,12 +4,7 @@
** See Copyright Notice in mruby.h
*/
-#ifndef SIZE_MAX
- /* Some versions of VC++
- * has SIZE_MAX in stdint.h
- */
-# include <limits.h>
-#endif
+#include <limits.h>
#include "mruby.h"
#include "mruby/array.h"
#include "mruby/class.h"
diff --git a/src/class.c b/src/class.c
index 7cb0ca93a..d29089253 100644
--- a/src/class.c
+++ b/src/class.c
@@ -522,7 +522,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
s = mrb_str_ptr(ss);
len = (mrb_int)strlen(s->ptr);
if (len < s->len) {
- mrb_raise(mrb, E_ARGUMENT_ERROR, "String contains NUL");
+ mrb_raise(mrb, E_ARGUMENT_ERROR, "string contains null byte");
}
else if (len > s->len) {
mrb_str_modify(mrb, s);
diff --git a/src/gc.c b/src/gc.c
index 5592b48f1..9245adbfb 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -4,12 +4,7 @@
** See Copyright Notice in mruby.h
*/
-#ifndef SIZE_MAX
- /* Some versions of VC++
- * has SIZE_MAX in stdint.h
- */
-# include <limits.h>
-#endif
+#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include "mruby.h"
@@ -370,17 +365,19 @@ mrb_free_heap(mrb_state *mrb)
static void
gc_protect(mrb_state *mrb, struct RBasic *p)
{
- if (mrb->arena_idx >= MRB_GC_ARENA_SIZE) {
#ifdef MRB_GC_FIXED_ARENA
+ if (mrb->arena_idx >= MRB_GC_ARENA_SIZE) {
/* arena overflow error */
mrb->arena_idx = MRB_GC_ARENA_SIZE - 4; /* force room in arena */
mrb_raise(mrb, E_RUNTIME_ERROR, "arena overflow error");
+ }
#else
+ if (mrb->arena_idx >= mrb->arena_capa) {
/* extend arena */
mrb->arena_capa *= 1.5;
mrb->arena = (struct RBasic**)mrb_realloc(mrb, mrb->arena, sizeof(struct RBasic*)*mrb->arena_capa);
-#endif
}
+#endif
mrb->arena[mrb->arena_idx++] = p;
}
diff --git a/src/load.c b/src/load.c
index adc2416df..57845b2ca 100644
--- a/src/load.c
+++ b/src/load.c
@@ -4,12 +4,7 @@
** See Copyright Notice in mruby.h
*/
-#ifndef SIZE_MAX
- /* Some versions of VC++
- * has SIZE_MAX in stdint.h
- */
-# include <limits.h>
-#endif
+#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include "mruby/dump.h"
diff --git a/src/numeric.c b/src/numeric.c
index db90d81fb..0b841bf70 100644
--- a/src/numeric.c
+++ b/src/numeric.c
@@ -5,12 +5,6 @@
*/
#include <float.h>
-#if defined(__FreeBSD__) && __FreeBSD__ < 4
-# include <floatingpoint.h>
-#endif
-#ifdef HAVE_IEEEFP_H
-# include <ieeefp.h>
-#endif
#include <limits.h>
#include <math.h>
#include <stdlib.h>
diff --git a/src/string.c b/src/string.c
index 1c577188e..a687a4c29 100644
--- a/src/string.c
+++ b/src/string.c
@@ -5,12 +5,7 @@
*/
#include <ctype.h>
-#ifndef SIZE_MAX
- /* Some versions of VC++
- * has SIZE_MAX in stdint.h
- */
-# include <limits.h>
-#endif
+#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>