ruby-changes:4138
From: ko1@a...
Date: Thu, 28 Feb 2008 15:30:53 +0900 (JST)
Subject: [ruby-changes:4138] naruse - Ruby:r15628 (trunk): * io.c (rb_io_getline_fast): scan coderange.
naruse 2008-02-28 15:30:38 +0900 (Thu, 28 Feb 2008)
New Revision: 15628
Modified files:
trunk/ChangeLog
trunk/io.c
Log:
* io.c (rb_io_getline_fast): scan coderange.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15628&r2=15627&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/io.c?r1=15628&r2=15627&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 15627)
+++ ChangeLog (revision 15628)
@@ -1,3 +1,7 @@
+Thu Feb 28 15:29:12 2008 NARUSE, Yui <naruse@r...>
+
+ * io.c (rb_io_getline_fast): scan coderange.
+
Thu Feb 28 14:36:46 2008 NARUSE, Yui <naruse@r...>
* string.c (rb_enc_str_copy): removed.
Index: io.c
===================================================================
--- io.c (revision 15627)
+++ io.c (revision 15628)
@@ -1801,6 +1801,9 @@
{
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 @@
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 @@
}
str = io_enc_str(str, fptr);
+ ENC_CODERANGE_SET(str, cr);
fptr->lineno++;
lineno = INT2FIX(fptr->lineno);
return str;
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/