ruby-changes:4851
From: ko1@a...
Date: Sat, 10 May 2008 18:18:17 +0900 (JST)
Subject: [ruby-changes:4851] matz - Ruby:r16345 (trunk): * string.c (rb_str_each_line): zero length record separator should
matz 2008-05-10 18:17:59 +0900 (Sat, 10 May 2008)
New Revision: 16345
Modified files:
trunk/ChangeLog
trunk/string.c
trunk/version.h
Log:
* string.c (rb_str_each_line): zero length record separator should
split a string into paragraphs. [ruby-dev:34586]
* string.c (rb_str_each_line): RDoc updated.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/version.h?r1=16345&r2=16344&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/string.c?r1=16345&r2=16344&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16345&r2=16344&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 16344)
+++ ChangeLog (revision 16345)
@@ -1,3 +1,10 @@
+Sat May 10 18:11:18 2008 Yukihiro Matsumoto <matz@r...>
+
+ * string.c (rb_str_each_line): zero length record separator should
+ split a string into paragraphs. [ruby-dev:34586]
+
+ * string.c (rb_str_each_line): RDoc updated.
+
Sat May 10 11:36:20 2008 Tanaka Akira <akr@f...>
* vm.c (env_mark): mark env->block.self. prevent SEGV when GC occur
Index: string.c
===================================================================
--- string.c (revision 16344)
+++ string.c (revision 16345)
@@ -5018,9 +5018,8 @@
*
* Splits <i>str</i> using the supplied parameter as the record separator
* (<code>$/</code> by default), passing each substring in turn to the supplied
- * block. If a zero-length record separator is supplied, the string is split on
- * <code>\n</code> characters, except that multiple successive newlines are
- * appended together.
+ * block. If a zero-length record separator is supplied, the string is split
+ * into paragraphs delimited by multiple successive newlines.
*
* print "Example one\n"
* "hello\nworld".each {|s| p s}
@@ -5107,8 +5106,13 @@
while (p < pend) {
int c = rb_enc_codepoint(p, pend, enc);
+ again:
n = rb_enc_codelen(c, enc);
if (rslen == 0 && c == newline) {
+ p += n;
+ if (p < pend && (c = rb_enc_codepoint(p, pend, enc)) != newline) {
+ goto again;
+ }
while (p < pend && rb_enc_codepoint(p, pend, enc) == newline) {
p += n;
}
Index: version.h
===================================================================
--- version.h (revision 16344)
+++ version.h (revision 16345)
@@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
-#define RUBY_RELEASE_DATE "2008-05-09"
+#define RUBY_RELEASE_DATE "2008-05-10"
#define RUBY_VERSION_CODE 190
-#define RUBY_RELEASE_CODE 20080509
+#define RUBY_RELEASE_CODE 20080510
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 5
-#define RUBY_RELEASE_DAY 9
+#define RUBY_RELEASE_DAY 10
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/