aboutsummaryrefslogtreecommitdiffstats
path: root/ext/dbm
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-04 07:27:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-04 07:27:10 +0000
commit2731cdfd9d98358c4e4f7ec9ede8e675477fb73f (patch)
tree9a96e1d3ccc6de7a94b8d884ddb946b3c3701de3 /ext/dbm
parent6b1c4e9f98a3041de843a176bb946ecf500453da (diff)
downloadruby-2731cdfd9d98358c4e4f7ec9ede8e675477fb73f.tar.gz
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/dbm')
-rw-r--r--ext/dbm/dbm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
index d2904f5bbe..9202b9c2a8 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -528,7 +528,7 @@ fdbm_delete_if(VALUE obj)
}
for (i = 0; i < RARRAY_LEN(ary); i++) {
- keystr = RARRAY_PTR(ary)[i];
+ keystr = RARRAY_CONST_PTR(ary)[i];
key.dptr = RSTRING_PTR(keystr);
key.dsize = (DSIZE_TYPE)RSTRING_LEN(keystr);
if (dbm_delete(dbm, key)) {
@@ -599,11 +599,13 @@ static VALUE fdbm_store(VALUE,VALUE,VALUE);
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]");
}
- fdbm_store(dbm, RARRAY_PTR(pair)[0], RARRAY_PTR(pair)[1]);
+ ptr = RARRAY_CONST_PTR(pair);
+ fdbm_store(dbm, ptr[0], ptr[1]);
return Qnil;
}