summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/mruby/value.h4
-rw-r--r--mrbgems/mruby-sprintf/src/sprintf.c4
-rw-r--r--src/array.c7
-rw-r--r--src/class.c2
-rw-r--r--src/codegen.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
-rw-r--r--tasks/mrbgems_test.rake2
-rw-r--r--tasks/mruby_build_commands.rake4
-rw-r--r--tasks/mruby_build_gem.rake6
12 files changed, 18 insertions, 46 deletions
diff --git a/include/mruby/value.h b/include/mruby/value.h
index f30693c4a..13acd039e 100644
--- a/include/mruby/value.h
+++ b/include/mruby/value.h
@@ -155,7 +155,7 @@ typedef struct mrb_value {
#define mrb_tt(o) (((o).value.ttt & 0xfc000)>>14)
#define mrb_mktt(tt) (0xfff00000|((tt)<<14))
#define mrb_type(o) ((uint32_t)0xfff00000 < (o).value.ttt ? mrb_tt(o) : MRB_TT_FLOAT)
-#define mrb_ptr(o) ((void*)((((intptr_t)0x3fffffffffff)&((intptr_t)((o).value.p)))<<2))
+#define mrb_ptr(o) ((void*)((((uintptr_t)0x3fffffffffff)&((uintptr_t)((o).value.p)))<<2))
#define mrb_float(o) (o).f
#define MRB_SET_VALUE(o, tt, attr, v) do {\
@@ -166,7 +166,7 @@ typedef struct mrb_value {
case MRB_TT_UNDEF:\
case MRB_TT_FIXNUM:\
case MRB_TT_SYMBOL: (o).attr = (v); break;\
- default: (o).value.i = 0; (o).value.p = (void*)((intptr_t)(o).value.p | (((intptr_t)(v))>>2)); break;\
+ default: (o).value.i = 0; (o).value.p = (void*)((uintptr_t)(o).value.p | (((uintptr_t)(v))>>2)); break;\
}\
} while (0)
diff --git a/mrbgems/mruby-sprintf/src/sprintf.c b/mrbgems/mruby-sprintf/src/sprintf.c
index 6479b19bc..5485f5098 100644
--- a/mrbgems/mruby-sprintf/src/sprintf.c
+++ b/mrbgems/mruby-sprintf/src/sprintf.c
@@ -15,10 +15,6 @@
#include <math.h>
#include <ctype.h>
-#ifdef HAVE_IEEEFP_H
-#include <ieeefp.h>
-#endif
-
#define BIT_DIGITS(N) (((N)*146)/485 + 1) /* log2(10) =~ 146/485 */
#define BITSPERDIG (sizeof(mrb_int)*CHAR_BIT)
#define EXTENDSIGN(n, l) (((~0 << (n)) >> (((n)*(l)) % BITSPERDIG)) & ~(~0 << (n)))
diff --git a/src/array.c b/src/array.c
index 00a992d87..ec2465be1 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/codegen.c b/src/codegen.c
index 169371492..d0ec12bac 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -2895,7 +2895,7 @@ codedump_recur(mrb_state *mrb, mrb_irep *irep)
void
codedump_all(mrb_state *mrb, struct RProc *proc)
{
- return codedump_recur(mrb, proc->body.irep);
+ codedump_recur(mrb, proc->body.irep);
}
struct RProc*
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 d00d9423a..e8c37180d 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>
diff --git a/tasks/mrbgems_test.rake b/tasks/mrbgems_test.rake
index d74351fe9..500161103 100644
--- a/tasks/mrbgems_test.rake
+++ b/tasks/mrbgems_test.rake
@@ -8,7 +8,7 @@ MRuby.each_target do
g.print_gem_init_header(f)
test_preload = [g.dir, MRUBY_ROOT].map {|dir|
File.expand_path(g.test_preload, dir)
- }.find {|file| File.exists?(file) }
+ }.find {|file| File.exist?(file) }
g.build.mrbc.run f, test_preload, "gem_test_irep_#{g.funcname}_preload"
g.test_rbfiles.flatten.each_with_index do |rbfile, i|
diff --git a/tasks/mruby_build_commands.rake b/tasks/mruby_build_commands.rake
index 349b8717d..d7b87514e 100644
--- a/tasks/mruby_build_commands.rake
+++ b/tasks/mruby_build_commands.rake
@@ -106,7 +106,7 @@ module MRuby
private
def get_dependencies(file)
file = file.ext('d') unless File.extname(file) == '.d'
- if File.exists?(file)
+ if File.exist?(file)
File.read(file).gsub("\\\n ", "").scan(/^\S+:\s+(.+)$/).flatten.map {|s| s.split(' ') }.flatten
else
[]
@@ -265,7 +265,7 @@ module MRuby
# if mrbc execution fail, drop the file
unless $?.exitstatus
File.delete(out.path)
- exit -1
+ exit(-1)
end
end
end
diff --git a/tasks/mruby_build_gem.rake b/tasks/mruby_build_gem.rake
index ea1307132..0f920dbc8 100644
--- a/tasks/mruby_build_gem.rake
+++ b/tasks/mruby_build_gem.rake
@@ -2,7 +2,7 @@ module MRuby
module LoadGems
def gembox(gemboxfile)
gembox = File.expand_path("#{gemboxfile}.gembox", "#{MRUBY_ROOT}/mrbgems")
- fail "Can't find gembox '#{gembox}'" unless File.exists?(gembox)
+ fail "Can't find gembox '#{gembox}'" unless File.exist?(gembox)
GemBox.config = self
GemBox.path = gembox
@@ -25,7 +25,7 @@ module MRuby
gemrake = File.join(gemdir, "mrbgem.rake")
- fail "Can't find #{gemrake}" unless File.exists?(gemrake)
+ fail "Can't find #{gemrake}" unless File.exist?(gemrake)
Gem.current = nil
load gemrake
return nil unless Gem.current
@@ -50,7 +50,7 @@ module MRuby
url = params[:git]
gemdir = "#{gem_clone_dir}/#{url.match(/([-\w]+)(\.[-\w]+|)$/).to_a[1]}"
- if File.exists?(gemdir)
+ if File.exist?(gemdir)
if $pull_gems
git.run_pull gemdir, url
else