summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-28 06:30:38 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-28 06:30:38 +0000
commit198e1d074c187d2a4e8b9d1bb378a714b2d6001b (patch)
tree329a59bc9bb1a02c666661a0e59cbdaf501c35d7
parent51411c1f882e8d455249de2768366c25ba3a9b50 (diff)
* io.c (rb_io_getline_fast): scan coderange.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--io.c6
2 files changed, 10 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 8533c88d2ac..abe441bd8a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Feb 28 15:29:12 2008 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (rb_io_getline_fast): scan coderange.
+
Thu Feb 28 14:36:46 2008 NARUSE, Yui <naruse@ruby-lang.org>
* string.c (rb_enc_str_copy): removed.
diff --git a/io.c b/io.c
index cbca404d060..cfb86e44c9c 100644
--- a/io.c
+++ b/io.c
@@ -1801,6 +1801,9 @@ rb_io_getline_fast(rb_io_t *fptr)
{
VALUE str = Qnil;
int len = 0;
+ long pos = 0;
+ rb_encoding *enc = io_read_encoding(fptr);
+ int cr = 0;
for (;;) {
long pending = READ_DATA_PENDING_COUNT(fptr);
@@ -1823,6 +1826,8 @@ rb_io_getline_fast(rb_io_t *fptr)
read_buffered_data(RSTRING_PTR(str)+len, pending, fptr);
}
len += pending;
+ if (cr != ENC_CODERANGE_BROKEN)
+ pos = rb_str_coderange_scan_restartable(RSTRING_PTR(str) + pos, RSTRING_PTR(str) + len, enc, &cr);
if (e) break;
}
rb_thread_wait_fd(fptr->fd);
@@ -1834,6 +1839,7 @@ rb_io_getline_fast(rb_io_t *fptr)
}
str = io_enc_str(str, fptr);
+ ENC_CODERANGE_SET(str, cr);
fptr->lineno++;
lineno = INT2FIX(fptr->lineno);
return str;