From 508b255b9a11b03fd08efbe9855bc985f702076f Mon Sep 17 00:00:00 2001 From: ko1 Date: Fri, 21 Jun 2013 11:53:33 +0000 Subject: * include/ruby/ruby.h: constify RArray::as::ary and RArray::heap::ptr. Use RARRAY_ASET() or RARRAY_PTR_USE() to modify Array objects. * array.c, gc.c: catch up above changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- include/ruby/ruby.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include/ruby/ruby.h') diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index f812e3146b..79bb110563 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -933,9 +933,9 @@ struct RArray { long capa; VALUE shared; } aux; - VALUE *ptr; + const VALUE *ptr; } heap; - VALUE ary[RARRAY_EMBED_LEN_MAX]; + const VALUE ary[RARRAY_EMBED_LEN_MAX]; } as; }; #define RARRAY_EMBED_FLAG FL_USER1 @@ -961,7 +961,7 @@ struct RArray { #define RARRAY_PTR_USE(ary, ptr_name, expr) do { \ const VALUE _ary = (ary); \ - VALUE *ptr_name = RARRAY_PTR_USE_START(_ary); \ + VALUE *ptr_name = (VALUE *)RARRAY_PTR_USE_START(_ary); \ expr; \ RARRAY_PTR_USE_END(_ary); \ } while (0) @@ -969,10 +969,10 @@ struct RArray { #define RARRAY_AREF(a, i) (RARRAY_RAWPTR(a)[i]) #define RARRAY_ASET(a, i, v) do { \ const VALUE _ary_ = (a); \ - OBJ_WRITE(_ary_, &RARRAY_RAWPTR(_ary_)[i], (v)); \ + OBJ_WRITE(_ary_, (VALUE *)&RARRAY_RAWPTR(_ary_)[i], (v)); \ } while (0) -#define RARRAY_PTR(a) RARRAY_RAWPTR(RGENGC_WB_PROTECTED_ARRAY ? OBJ_WB_GIVEUP((VALUE)a) : ((VALUE)a)) +#define RARRAY_PTR(a) ((VALUE *)RARRAY_RAWPTR(RGENGC_WB_PROTECTED_ARRAY ? OBJ_WB_GIVEUP((VALUE)a) : ((VALUE)a))) struct RRegexp { struct RBasic basic; -- cgit v1.2.3