summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-08-30 14:49:51 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-08-30 14:49:51 +0000
commit74433fd300ff90e61086681fd1152d2da0d28171 (patch)
tree34fedf9739363293313b40fa4509e7f87ef93880 /hash.c
parent87e8b14cc403f13d5c0d3cbd715a2d85c52fcb95 (diff)
* array.c, dir.c, enum.c, hash.c, io.c, range.c, string.c, struct.c:
let enumerable methods return Enumerator. [ruby-dev:26924] * intern.h (RETURN_ENUMERATOR): utility macro for enumerable methods. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/hash.c b/hash.c
index f221418b60..7eb12ce286 100644
--- a/hash.c
+++ b/hash.c
@@ -833,6 +833,7 @@ rb_hash_select(hash)
{
VALUE result;
+ RETURN_ENUMERATOR(hash, 0, 0);
result = rb_ary_new();
rb_hash_foreach(hash, select_i, result);
return result;
@@ -1011,6 +1012,7 @@ static VALUE
rb_hash_each_value(hash)
VALUE hash;
{
+ RETURN_ENUMERATOR(hash, 0, 0);
rb_hash_foreach(hash, each_value_i, 0);
return hash;
}
@@ -1043,6 +1045,7 @@ static VALUE
rb_hash_each_key(hash)
VALUE hash;
{
+ RETURN_ENUMERATOR(hash, 0, 0);
rb_hash_foreach(hash, each_key_i, 0);
return hash;
}
@@ -1077,6 +1080,7 @@ static VALUE
rb_hash_each_pair(hash)
VALUE hash;
{
+ RETURN_ENUMERATOR(hash, 0, 0);
rb_hash_foreach(hash, each_pair_i, 0);
return hash;
}
@@ -1114,6 +1118,7 @@ static VALUE
rb_hash_each(hash)
VALUE hash;
{
+ RETURN_ENUMERATOR(hash, 0, 0);
rb_hash_foreach(hash, each_i, 0);
return hash;
}
@@ -1930,6 +1935,7 @@ env_each_key(ehash)
VALUE keys;
long i;
+ RETURN_ENUMERATOR(ehash, 0, 0);
rb_secure(4);
keys = env_keys();
for (i=0; i<RARRAY(keys)->len; i++) {
@@ -1965,6 +1971,7 @@ env_each_value(ehash)
VALUE values = env_values();
long i;
+ RETURN_ENUMERATOR(ehash, 0, 0);
rb_secure(4);
values = env_values();
for (i=0; i<RARRAY(values)->len; i++) {
@@ -2010,6 +2017,7 @@ static VALUE
env_each(ehash)
VALUE ehash;
{
+ RETURN_ENUMERATOR(ehash, 0, 0);
return env_each_i(ehash, Qfalse);
}
@@ -2017,6 +2025,7 @@ static VALUE
env_each_pair(ehash)
VALUE ehash;
{
+ RETURN_ENUMERATOR(ehash, 0, 0);
return env_each_i(ehash, Qtrue);
}
@@ -2067,11 +2076,13 @@ env_values_at(argc, argv)
}
static VALUE
-env_select()
+env_select(ehash)
+ VALUE ehash;
{
VALUE result;
char **env;
+ RETURN_ENUMERATOR(ehash, 0, 0);
rb_secure(4);
result = rb_ary_new();
env = GET_ENVIRON(environ);