summaryrefslogtreecommitdiff
path: root/ext/zlib/zlib.c
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-22 17:22:04 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-22 17:22:04 +0000
commitc47c095b9740e7c19d6fdca29ab661c1089221d4 (patch)
tree6a8204e2977b6743db056b348b2167cdbc11a06b /ext/zlib/zlib.c
parent2742b6bc432e82a502a7fe7234090592a31dc432 (diff)
Deprecate #{lines,bytes,chars,codepoints} of IO-likes.
* io.c (rb_io_lines, rb_io_bytes, rb_io_chars, rb_io_codepoints): Deprecate IO#{lines,bytes,chars,codepoints} and those of ARGF. [Feature #6670] * ext/stringio/stringio.c (strio_lines, strio_bytes, strio_chars) (strio_codepoints): Deprecate StringIO#{lines,bytes,chars,codepoints}. [Feature #6670] * ext/zlib/zlib.c (rb_gzreader_lines, rb_gzreader_bytes): Deprecate Zlib::GzipReader#{lines,bytes}. [Feature #6670] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/zlib/zlib.c')
-rw-r--r--ext/zlib/zlib.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 6b6299c..d962c0a 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -3880,6 +3880,20 @@ rb_gzreader_each_byte(VALUE obj)
}
/*
+ * Document-method: Zlib::GzipReader#bytes
+ *
+ * This is a deprecated alias for <code>each_byte</code>.
+ */
+static VALUE
+rb_gzreader_bytes(VALUE obj)
+{
+ rb_warn("Zlib::GzipReader#bytes is deprecated; use #each_byte instead");
+ if (!rb_block_given_p())
+ return rb_enumeratorize(obj, ID2SYM(rb_intern("each_byte")), 0, 0);
+ return rb_gzreader_each_byte(obj);
+}
+
+/*
* Document-method: Zlib::GzipReader#ungetc
*
* See Zlib::GzipReader documentation for a description.
@@ -4146,6 +4160,20 @@ rb_gzreader_each(int argc, VALUE *argv, VALUE obj)
}
/*
+ * Document-method: Zlib::GzipReader#lines
+ *
+ * This is a deprecated alias for <code>each_line</code>.
+ */
+static VALUE
+rb_gzreader_lines(int argc, VALUE *argv, VALUE obj)
+{
+ rb_warn("Zlib::GzipReader#lines is deprecated; use #each_line instead");
+ if (!rb_block_given_p())
+ return rb_enumeratorize(obj, ID2SYM(rb_intern("each_line")), argc, argv);
+ return rb_gzreader_each_line(argc, argv, obj);
+}
+
+/*
* Document-method: Zlib::GzipReader#readlines
*
* See Zlib::GzipReader documentation for a description.
@@ -4420,14 +4448,14 @@ Init_zlib()
rb_define_method(cGzipReader, "readbyte", rb_gzreader_readbyte, 0);
rb_define_method(cGzipReader, "each_byte", rb_gzreader_each_byte, 0);
rb_define_method(cGzipReader, "each_char", rb_gzreader_each_char, 0);
- rb_define_method(cGzipReader, "bytes", rb_gzreader_each_byte, 0);
+ rb_define_method(cGzipReader, "bytes", rb_gzreader_bytes, 0);
rb_define_method(cGzipReader, "ungetc", rb_gzreader_ungetc, 1);
rb_define_method(cGzipReader, "ungetbyte", rb_gzreader_ungetbyte, 1);
rb_define_method(cGzipReader, "gets", rb_gzreader_gets, -1);
rb_define_method(cGzipReader, "readline", rb_gzreader_readline, -1);
rb_define_method(cGzipReader, "each", rb_gzreader_each, -1);
rb_define_method(cGzipReader, "each_line", rb_gzreader_each, -1);
- rb_define_method(cGzipReader, "lines", rb_gzreader_each, -1);
+ rb_define_method(cGzipReader, "lines", rb_gzreader_lines, -1);
rb_define_method(cGzipReader, "readlines", rb_gzreader_readlines, -1);
/* The OS code of current host */