summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-09-12 12:42:39 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-09-12 12:42:39 +0900
commit48c5321dca85025b8b11e43c8db2726fccb45b9d (patch)
tree26f72cf0dfdfae040bc92b31c99f870c8c5fcf01 /include
parent7ea8803e06d349105c12e4470b34626b60447599 (diff)
downloadmruby-48c5321dca85025b8b11e43c8db2726fccb45b9d.tar.gz
mruby-48c5321dca85025b8b11e43c8db2726fccb45b9d.zip
constify pointer from RARRAY_PTR to detect potential write barrier bugs.
if you see compiler errors due to this commit, you'd better to use array-modifying functions, e.g. mrb_ary_set() or mrb_ary_push(), otherwise you might see nasty GC bugs in the future. if you are sure what you are doing, replace `RARRAY_PTR(ary)` by `mrb_ary_ptr(ary)->ptr`. but be warned.
Diffstat (limited to 'include')
-rw-r--r--include/mruby/array.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/mruby/array.h b/include/mruby/array.h
index c984c16a7..0b17b47fd 100644
--- a/include/mruby/array.h
+++ b/include/mruby/array.h
@@ -32,7 +32,7 @@ struct RArray {
#define RARRAY(v) ((struct RArray*)(mrb_ptr(v)))
#define RARRAY_LEN(a) (RARRAY(a)->len)
-#define RARRAY_PTR(a) (RARRAY(a)->ptr)
+#define RARRAY_PTR(a) ((const mrb_value*)RARRAY(a)->ptr)
#define MRB_ARY_SHARED 256
#define ARY_SHARED_P(a) ((a)->flags & MRB_ARY_SHARED)
#define ARY_SET_SHARED_FLAG(a) ((a)->flags |= MRB_ARY_SHARED)