diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-06-20 14:02:40 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-06-20 14:02:40 +0900 |
commit | 9ac070d0ff16523c24b171e20123840e21b4dbec (patch) | |
tree | 2e12eb2803af8fb39d161772c89ee3066c71a00c /marshal.c | |
parent | 2dfbe91cad2ebc6aa1a925b1b77b7af07fec1403 (diff) |
Copy instance variables to regexp from marshaled data
`rb_ivar_foreach` disallows `ST_DELETE`.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7962
Diffstat (limited to 'marshal.c')
-rw-r--r-- | marshal.c | 16 |
1 files changed, 1 insertions, 15 deletions
@@ -1803,20 +1803,6 @@ r_object0(struct load_arg *arg, bool partial, int *ivp, VALUE extmod) return r_object_for(arg, partial, ivp, extmod, type); } -static int -r_move_ivar(st_data_t k, st_data_t v, st_data_t d) -{ - ID key = (ID)k; - VALUE value = (VALUE)v; - VALUE dest = (VALUE)d; - - if (rb_is_instance_id(key)) { - rb_ivar_set(dest, key, value); - return ST_DELETE; - } - return ST_CONTINUE; -} - static VALUE r_object_for(struct load_arg *arg, bool partial, int *ivp, VALUE extmod, int type) { @@ -2034,7 +2020,7 @@ r_object_for(struct load_arg *arg, bool partial, int *ivp, VALUE extmod, int typ rb_str_set_len(str, dst - ptr); } VALUE regexp = rb_reg_new_str(str, options); - rb_ivar_foreach(str, r_move_ivar, regexp); + r_copy_ivar(regexp, str); v = r_entry0(regexp, idx, arg); v = r_leave(v, arg, partial); |