summaryrefslogtreecommitdiff
path: root/ext/dbm
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-21 08:48:33 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-21 08:48:33 +0000
commitffc456d0ed1acf478ff991c88e35b2038dccb402 (patch)
tree847b4cfc16cc66aac40816b9e9769ffb64f95794 /ext/dbm
parenteeceb720a9589bd9a0acf47db9da05668d7a5865 (diff)
* ext/dbm/dbm.c (fdbm_each_value, fdbm_each_key, fdbm_each_pair):
GDBM#{each,each_pair,each_key,each_value}: Return an enumerator if no block is given. * ext/gdbm/gdbm.c (fgdbm_each_value, fgdbm_each_key, fgdbm_each_pair): GDBM#{each,each_pair,each_key,each_value}: Return an enumerator if no block is given. * ext/openssl/ossl_config.c (ossl_config_each): OpenSSL::Config#each: Return an enumerator if no block is given. * ext/readline/readline.c (hist_each): Readline::HISTORY#each: Return an enumerator if no block is given. * ext/sdbm/init.c (fsdbm_each_value, fsdbm_each_key, fsdbm_each_pair): SDBM#{each,each_pair,each_key,each_value}: Return an enumerator if no block is given. * ext/stringio/stringio.c (strio_each_byte, strio_each): StringIO#{each,each_line,each_byte}: Return an enumerator if no block is given. * ext/stringio/stringio.c (Init_stringio): Add #lines and #bytes, which are aliases to #each_line and #each_byte, respectively. * ext/win32ole/win32ole.c (fole_each): WIN32OLE#each: Return an enumerator if no block is given. * ext/zlib/zlib.c (rb_gzreader_each_byte, rb_gzreader_each): Zlib::GzipReader#{each,each_line,each_byte}: Return an enumerator if no block is given. * ext/zlib/zlib.c (Init_zlib): Add Zlib::GzipReader#lines and #bytes, which are aliases to #each_line and #each_byte, respectively. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dbm')
-rw-r--r--ext/dbm/dbm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
index 818eaa7..8cad97c 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -505,6 +505,8 @@ fdbm_each_value(VALUE obj)
struct dbmdata *dbmp;
DBM *dbm;
+ RETURN_ENUMERATOR(obj, 0, 0);
+
GetDBM2(obj, dbmp, dbm);
for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
val = dbm_fetch(dbm, key);
@@ -521,6 +523,8 @@ fdbm_each_key(VALUE obj)
struct dbmdata *dbmp;
DBM *dbm;
+ RETURN_ENUMERATOR(obj, 0, 0);
+
GetDBM2(obj, dbmp, dbm);
for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
rb_yield(rb_tainted_str_new(key.dptr, key.dsize));
@@ -537,6 +541,8 @@ fdbm_each_pair(VALUE obj)
struct dbmdata *dbmp;
VALUE keystr, valstr;
+ RETURN_ENUMERATOR(obj, 0, 0);
+
GetDBM2(obj, dbmp, dbm);
for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {