[前][次][番号順一覧][スレッド一覧]

ruby-changes:40776

From: nobu <ko1@a...>
Date: Wed, 2 Dec 2015 15:50:50 +0900 (JST)
Subject: [ruby-changes:40776] nobu:r52855 (trunk): marshal.c: lookup and remove

nobu	2015-12-02 15:50:41 +0900 (Wed, 02 Dec 2015)

  New Revision: 52855

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52855

  Log:
    marshal.c: lookup and remove
    
    * marshal.c (r_fixup_compat): delete compatible object with
      lookup.

  Modified files:
    trunk/marshal.c
Index: marshal.c
===================================================================
--- marshal.c	(revision 52854)
+++ marshal.c	(revision 52855)
@@ -1420,15 +1420,14 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/marshal.c#L1420
 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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]