summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-02 06:50:41 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-02 06:50:41 (GMT)
commita497ed37332948baf3433210e46c7bb71dfe33a6 (patch)
treea572ab97f31de22615014d97920ee7012d4710cd /marshal.c
parent4bef8cffa3218f9891a80bb2e7e0d25c5928dade (diff)
marshal.c: lookup and remove
* marshal.c (r_fixup_compat): delete compatible object with lookup. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/marshal.c b/marshal.c
index 752f053..74d66a2 100644
--- a/marshal.c
+++ b/marshal.c
@@ -1420,15 +1420,14 @@ static VALUE
r_fixup_compat(VALUE v, struct load_arg *arg)
{
st_data_t data;
- if (arg->compat_tbl && st_lookup(arg->compat_tbl, v, &data)) {
+ st_data_t key = (st_data_t)v;
+ if (arg->compat_tbl && st_delete(arg->compat_tbl, &key, &data)) {
VALUE real_obj = (VALUE)data;
rb_alloc_func_t allocator = rb_get_alloc_func(CLASS_OF(real_obj));
- st_data_t key = v;
if (st_lookup(compat_allocator_tbl, (st_data_t)allocator, &data)) {
marshal_compat_t *compat = (marshal_compat_t*)data;
compat->loader(real_obj, v);
}
- st_delete(arg->compat_tbl, &key, 0);
v = real_obj;
}
return v;