summaryrefslogtreecommitdiff
path: root/ext/gdbm
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-04 07:27:10 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-04 07:27:10 (GMT)
commit3553a86eb51365cc524cf5c549b37770448d550d (patch)
tree9a96e1d3ccc6de7a94b8d884ddb946b3c3701de3 /ext/gdbm
parent52912db4a81f9b9b69ab9e9fcd95e22d086d4289 (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/gdbm')
-rw-r--r--ext/gdbm/gdbm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/gdbm/gdbm.c b/ext/gdbm/gdbm.c
index 143b4e8..445facc 100644
--- a/ext/gdbm/gdbm.c
+++ b/ext/gdbm/gdbm.c
@@ -634,7 +634,7 @@ fgdbm_delete_if(VALUE obj)
}
for (i = 0; i < RARRAY_LEN(ary); i++)
- rb_gdbm_delete(obj, RARRAY_PTR(ary)[i]);
+ rb_gdbm_delete(obj, RARRAY_CONST_PTR(ary)[i]);
if (status) rb_jump_tag(status);
if (n > 0) dbmp->di_size = n - (int)RARRAY_LEN(ary);
rb_ary_clear(ary);
@@ -747,11 +747,13 @@ fgdbm_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]");
}
- fgdbm_store(dbm, RARRAY_PTR(pair)[0], RARRAY_PTR(pair)[1]);
+ ptr = RARRAY_CONST_PTR(pair);
+ fgdbm_store(dbm, ptr[0], ptr[1]);
return Qnil;
}