diff options
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; } |