зеркало из https://github.com/github/ruby.git
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
This commit is contained in:
Родитель
23335c78d3
Коммит
11391aa01b
7
thread.c
7
thread.c
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче