ruby-changes:28081
From: nobu <ko1@a...>
Date: Sat, 6 Apr 2013 00:24:26 +0900 (JST)
Subject: [ruby-changes:28081] nobu:r40133 (trunk): thread.c: no allocate before deleting
nobu 2013-04-06 00:21:02 +0900 (Sat, 06 Apr 2013) New Revision: 40133 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40133 Log: thread.c: no allocate before deleting * thread.c (rb_thread_local_aset): no needs to allocate local_storage before deleting. Modified files: trunk/thread.c Index: thread.c =================================================================== --- thread.c (revision 40132) +++ thread.c (revision 40133) @@ -2803,13 +2803,14 @@ rb_thread_local_aset(VALUE thread, ID id https://github.com/ruby/ruby/blob/trunk/thread.c#L2803 if (OBJ_FROZEN(thread)) { rb_error_frozen("thread locals"); } - if (!th->local_storage) { - th->local_storage = st_init_numtable(); - } if (NIL_P(val)) { + if (!th->local_storage) return Qnil; st_delete_wrap(th->local_storage, id); return Qnil; } + if (!th->local_storage) { + th->local_storage = st_init_numtable(); + } st_insert(th->local_storage, id, val); return val; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/