зеркало из https://github.com/github/ruby.git
* hash.c (env_each_pair): do not call rb_assoc_new() if
it isn't needed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
d190241a9e
Коммит
7eaee5b5e2
|
@ -1,3 +1,8 @@
|
|||
Mon Sep 23 12:11:26 2013 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* hash.c (env_each_pair): do not call rb_assoc_new() if
|
||||
it isn't needed.
|
||||
|
||||
Mon Sep 23 10:42:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* test/ruby/test_module.rb (TestModule#test_include_toplevel): test
|
||||
|
|
11
hash.c
11
hash.c
|
@ -2901,8 +2901,15 @@ env_each_pair(VALUE ehash)
|
|||
}
|
||||
FREE_ENVIRON(environ);
|
||||
|
||||
for (i=0; i<RARRAY_LEN(ary); i+=2) {
|
||||
rb_yield(rb_assoc_new(RARRAY_AREF(ary, i), RARRAY_AREF(ary, i+1)));
|
||||
if (rb_block_arity() > 1) {
|
||||
for (i=0; i<RARRAY_LEN(ary); i+=2) {
|
||||
rb_yield_values(2, RARRAY_AREF(ary, i), RARRAY_AREF(ary, i+1));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (i=0; i<RARRAY_LEN(ary); i+=2) {
|
||||
rb_yield(rb_assoc_new(RARRAY_AREF(ary, i), RARRAY_AREF(ary, i+1)));
|
||||
}
|
||||
}
|
||||
return ehash;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче