* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
332529d45a
commit
9139a48f0e
@ -1,3 +1,10 @@
|
|||||||
|
Sat May 10 18:11:18 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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@fsij.org>
|
Sat May 10 11:36:20 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* vm.c (env_mark): mark env->block.self. prevent SEGV when GC occur
|
* vm.c (env_mark): mark env->block.self. prevent SEGV when GC occur
|
||||||
|
10
string.c
10
string.c
@ -5018,9 +5018,8 @@ rb_str_split(VALUE str, const char *sep0)
|
|||||||
*
|
*
|
||||||
* Splits <i>str</i> using the supplied parameter as the record separator
|
* Splits <i>str</i> using the supplied parameter as the record separator
|
||||||
* (<code>$/</code> by default), passing each substring in turn to the supplied
|
* (<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
|
* block. If a zero-length record separator is supplied, the string is split
|
||||||
* <code>\n</code> characters, except that multiple successive newlines are
|
* into paragraphs delimited by multiple successive newlines.
|
||||||
* appended together.
|
|
||||||
*
|
*
|
||||||
* print "Example one\n"
|
* print "Example one\n"
|
||||||
* "hello\nworld".each {|s| p s}
|
* "hello\nworld".each {|s| p s}
|
||||||
@ -5107,8 +5106,13 @@ rb_str_each_line(int argc, VALUE *argv, VALUE str)
|
|||||||
while (p < pend) {
|
while (p < pend) {
|
||||||
int c = rb_enc_codepoint(p, pend, enc);
|
int c = rb_enc_codepoint(p, pend, enc);
|
||||||
|
|
||||||
|
again:
|
||||||
n = rb_enc_codelen(c, enc);
|
n = rb_enc_codelen(c, enc);
|
||||||
if (rslen == 0 && c == newline) {
|
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) {
|
while (p < pend && rb_enc_codepoint(p, pend, enc) == newline) {
|
||||||
p += n;
|
p += n;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#define RUBY_VERSION "1.9.0"
|
#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_VERSION_CODE 190
|
||||||
#define RUBY_RELEASE_CODE 20080509
|
#define RUBY_RELEASE_CODE 20080510
|
||||||
#define RUBY_PATCHLEVEL 0
|
#define RUBY_PATCHLEVEL 0
|
||||||
|
|
||||||
#define RUBY_VERSION_MAJOR 1
|
#define RUBY_VERSION_MAJOR 1
|
||||||
@ -9,7 +9,7 @@
|
|||||||
#define RUBY_VERSION_TEENY 0
|
#define RUBY_VERSION_TEENY 0
|
||||||
#define RUBY_RELEASE_YEAR 2008
|
#define RUBY_RELEASE_YEAR 2008
|
||||||
#define RUBY_RELEASE_MONTH 5
|
#define RUBY_RELEASE_MONTH 5
|
||||||
#define RUBY_RELEASE_DAY 9
|
#define RUBY_RELEASE_DAY 10
|
||||||
|
|
||||||
#ifdef RUBY_EXTERN
|
#ifdef RUBY_EXTERN
|
||||||
RUBY_EXTERN const char ruby_version[];
|
RUBY_EXTERN const char ruby_version[];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user