[前][次][番号順一覧][スレッド一覧]

ruby-changes:3721

From: ko1@a...
Date: Thu, 24 Jan 2008 16:34:29 +0900 (JST)
Subject: [ruby-changes:3721] matz - Ruby:r15210 (trunk): * io.c (rb_io_getline_fast): the end point of left_char_head()

matz	2008-01-24 16:34:07 +0900 (Thu, 24 Jan 2008)

  New Revision: 15210

  Modified files:
    trunk/ChangeLog
    trunk/io.c

  Log:
    * io.c (rb_io_getline_fast): the end point of left_char_head()
      must be the last character.  [ruby-cvs:22445]

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15210&r2=15209&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/io.c?r1=15210&r2=15209&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 15209)
+++ ChangeLog	(revision 15210)
@@ -1,3 +1,8 @@
+Thu Jan 24 16:31:04 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* io.c (rb_io_getline_fast): the end point of left_char_head()
+	  must be the last character.  [ruby-cvs:22445]
+
 Thu Jan 24 16:24:25 2008  NAKAMURA Usaku  <usa@r...>
 
 	* parse.y (reg_fragment_setenc_gen): recognize regexp with option n as
Index: io.c
===================================================================
--- io.c	(revision 15209)
+++ io.c	(revision 15210)
@@ -1799,12 +1799,14 @@
 
 	if (pending > 0) {
 	    const char *p = READ_DATA_PENDING_PTR(fptr);
+	    const char *pend = p + pending - 1;
 	    const char *e;
 
 	    e = memchr(p, '\n', pending);
 	    if (e) {
 		const char *p0 = rb_enc_left_char_head(p, e, enc);
-		const char *pend = rb_enc_left_char_head(p, p+pending, enc);
+
+		pend = rb_enc_left_char_head(p0, pend, enc);
 		if (rb_enc_is_newline(p0, pend, enc)) {
 		    pending = p0 - p + rb_enc_mbclen(p0, pend, enc);
 		}

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]