diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-04 07:27:10 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-04 07:27:10 +0000 |
commit | 3553a86eb51365cc524cf5c549b37770448d550d (patch) | |
tree | 9a96e1d3ccc6de7a94b8d884ddb946b3c3701de3 /ext/sdbm | |
parent | 52912db4a81f9b9b69ab9e9fcd95e22d086d4289 (diff) |
ext: use RARRAY_CONST_PTR
* ext/bigdecimal/bigdecimal.c: use RARRAY_CONST_PTR just fore
reference instead of RARRAY_PTR, to keep the array WB-protected.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/sdbm')
-rw-r--r-- | ext/sdbm/init.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/sdbm/init.c b/ext/sdbm/init.c index b0bb8880a8..aecbeced32 100644 --- a/ext/sdbm/init.c +++ b/ext/sdbm/init.c @@ -530,7 +530,7 @@ fsdbm_delete_if(VALUE obj) } for (i = 0; i < RARRAY_LEN(ary); i++) { - keystr = RARRAY_PTR(ary)[i]; + keystr = RARRAY_CONST_PTR(ary)[i]; ExportStringValue(keystr); key.dptr = RSTRING_PTR(keystr); key.dsize = RSTRING_LENINT(keystr); @@ -655,11 +655,13 @@ fsdbm_store(VALUE obj, VALUE keystr, VALUE valstr) static VALUE update_i(RB_BLOCK_CALL_FUNC_ARGLIST(pair, dbm)) { + const VALUE *ptr; Check_Type(pair, T_ARRAY); if (RARRAY_LEN(pair) < 2) { rb_raise(rb_eArgError, "pair must be [key, value]"); } - fsdbm_store(dbm, RARRAY_PTR(pair)[0], RARRAY_PTR(pair)[1]); + ptr = RARRAY_CONST_PTR(pair); + fsdbm_store(dbm, ptr[0], ptr[1]); return Qnil; } |