diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-05 15:21:02 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-05 15:21:02 +0000 |
commit | 11391aa01b2953a196828bfc46f0a75bed614c23 (patch) | |
tree | 7abe725e154602fa573b52e314c02d42ad98b218 /thread.c | |
parent | 23335c78d35921483df65a7cd8cd462f08ddbdcb (diff) |
thread.c: no allocate before deleting
* thread.c (rb_thread_local_aset): no needs to allocate local_storage
before deleting.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -2803,13 +2803,14 @@ rb_thread_local_aset(VALUE thread, ID id, VALUE val) 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; } |