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

ruby-changes:13981

From: wanabe <ko1@a...>
Date: Mon, 16 Nov 2009 08:11:44 +0900 (JST)
Subject: [ruby-changes:13981] Ruby:r25789 (trunk): * io.c (read_all): don't call io_shift_cbuf until bufffering enough or

wanabe	2009-11-16 08:11:26 +0900 (Mon, 16 Nov 2009)

  New Revision: 25789

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25789

  Log:
    * io.c (read_all): don't call io_shift_cbuf until bufffering enough or
      econv_finished.   [ruby-dev:39696]
    
    * io.c (more_char): don't call clear_readconv to read buffer after
      econv_finished.
    
    * io.c (appendline, rb_io_each_codepoint): clear readconv when done.

  Modified files:
    trunk/ChangeLog
    trunk/io.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 25788)
+++ ChangeLog	(revision 25789)
@@ -1,3 +1,13 @@
+Mon Nov 16 07:59:38 2009  wanabe  <s.wanabe@g...>
+
+	* io.c (read_all): don't call io_shift_cbuf until bufffering enough or
+	  econv_finished.   [ruby-dev:39696]
+
+	* io.c (more_char): don't call clear_readconv to read buffer after
+	  econv_finished.
+
+	* io.c (appendline, rb_io_each_codepoint): clear readconv when done.
+
 Mon Nov 16 01:58:08 2009  Yusuke Endoh  <mame@t...>
 
 	* include/ruby/ruby.h (rb_classext_t): annotate @internal.
Index: io.c
===================================================================
--- io.c	(revision 25788)
+++ io.c	(revision 25789)
@@ -1625,7 +1625,6 @@
             return 0;
 
         if (res == econv_finished) {
-	    clear_readconv(fptr);
             return -1;
 	}
 
@@ -1687,10 +1686,14 @@
         else rb_str_set_len(str, 0);
         make_readconv(fptr, 0);
         while (1) {
-            if (fptr->cbuf_len) {
+            if (fptr->cbuf_len > fptr->cbuf_capa / 2) {
                 io_shift_cbuf(fptr, fptr->cbuf_len, &str);
             }
             if (more_char(fptr) == -1) {
+		if (fptr->cbuf_len) {
+		    io_shift_cbuf(fptr, fptr->cbuf_len, &str);
+		}
+		clear_readconv(fptr);
                 return io_enc_str(str, fptr);
             }
         }
@@ -2172,6 +2175,7 @@
                 }
             }
         } while (more_char(fptr) != -1);
+        clear_readconv(fptr);
         *lp = limit;
         return EOF;
     }
@@ -2820,6 +2824,7 @@
 		    }
 		}
 		if (more_char(fptr) == -1) {
+		    clear_readconv(fptr);
 		    /* ignore an incomplete character before EOF */
 		    return io;
 		}

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

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