1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* hash.c (env_each_key, env_each_value, env_reject_bang)

(rb_env_clear, env_replace): Omit duplicated secure level check.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
knu 2008-05-25 16:06:00 +00:00
parent 49cd417578
commit 80b0ef5706
2 changed files with 10 additions and 10 deletions

View file

@ -1,3 +1,8 @@
Mon May 26 00:52:52 2008 Akinori MUSHA <knu@iDaemons.org>
* hash.c (env_each_key, env_each_value, env_reject_bang)
(rb_env_clear, env_replace): Omit duplicated secure level check.
Mon May 26 00:37:16 2008 Akinori MUSHA <knu@iDaemons.org>
* hash.c (env_each_value): Do not call env_values() twice.

15
hash.c
View file

@ -2086,8 +2086,7 @@ env_each_key(VALUE ehash)
long i;
RETURN_ENUMERATOR(ehash, 0, 0);
rb_secure(4);
keys = env_keys();
keys = env_keys(); /* rb_secure(4); */
for (i=0; i<RARRAY_LEN(keys); i++) {
rb_yield(RARRAY_PTR(keys)[i]);
}
@ -2121,8 +2120,7 @@ env_each_value(VALUE ehash)
long i;
RETURN_ENUMERATOR(ehash, 0, 0);
rb_secure(4);
values = env_values();
values = env_values(); /* rb_secure(4); */
for (i=0; i<RARRAY_LEN(values); i++) {
rb_yield(RARRAY_PTR(values)[i]);
}
@ -2165,8 +2163,7 @@ env_reject_bang(VALUE ehash)
int del = 0;
RETURN_ENUMERATOR(ehash, 0, 0);
rb_secure(4);
keys = env_keys();
keys = env_keys(); /* rb_secure(4); */
for (i=0; i<RARRAY_LEN(keys); i++) {
VALUE val = rb_f_getenv(Qnil, RARRAY_PTR(keys)[i]);
if (!NIL_P(val)) {
@ -2235,8 +2232,7 @@ rb_env_clear(void)
volatile VALUE keys;
long i;
rb_secure(4);
keys = env_keys();
keys = env_keys(); /* rb_secure(4); */
for (i=0; i<RARRAY_LEN(keys); i++) {
VALUE val = rb_f_getenv(Qnil, RARRAY_PTR(keys)[i]);
if (!NIL_P(val)) {
@ -2518,8 +2514,7 @@ env_replace(VALUE env, VALUE hash)
volatile VALUE keys;
long i;
rb_secure(4);
keys = env_keys();
keys = env_keys(); /* rb_secure(4); */
if (env == hash) return env;
hash = to_hash(hash);
rb_hash_foreach(hash, env_replace_i, keys);