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

ruby-changes:9962

From: nobu <ko1@a...>
Date: Wed, 14 Jan 2009 12:39:36 +0900 (JST)
Subject: [ruby-changes:9962] Ruby:r21503 (trunk): * io.c (appendline): reformed.

nobu	2009-01-14 12:38:06 +0900 (Wed, 14 Jan 2009)

  New Revision: 21503

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

  Log:
    * io.c (appendline): reformed.

  Modified files:
    trunk/ChangeLog
    trunk/io.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 21502)
+++ ChangeLog	(revision 21503)
@@ -1,5 +1,7 @@
-Wed Jan 14 12:35:20 2009  Nobuyoshi Nakada  <nobu@r...>
+Wed Jan 14 12:38:02 2009  Nobuyoshi Nakada  <nobu@r...>
 
+	* io.c (appendline): reformed.
+
 	* io.c (rb_io_s_pipe): reduced nest of rb_ensure of main block.
 
 Tue Jan 13 22:56:57 2009  Tanaka Akira  <akr@f...>
Index: io.c
===================================================================
--- io.c	(revision 21502)
+++ io.c	(revision 21503)
@@ -2016,7 +2016,7 @@
 
     if (NEED_READCONV(fptr)) {
         make_readconv(fptr, 0);
-        while (1) {
+        do {
             const char *p, *e;
             int searchlen;
             if (fptr->cbuf_len) {
@@ -2050,15 +2050,12 @@
                     return (unsigned char)RSTRING_PTR(str)[RSTRING_LEN(str)-1];
                 }
             }
-
-            if (more_char(fptr) == -1) {
-                *lp = limit;
-                return EOF;
-            }
-        }
+        } while (more_char(fptr) != -1);
+        *lp = limit;
+        return EOF;
     }
 
-    while (1) {
+    do {
 	long pending = READ_DATA_PENDING_COUNT(fptr);
 	if (pending > 0) {
 	    const char *p = READ_DATA_PENDING_PTR(fptr);
@@ -2082,15 +2079,13 @@
 	    *lp = limit;
 	    if (e) return delim;
 	    if (limit == 0)
-              return (unsigned char)RSTRING_PTR(str)[RSTRING_LEN(str)-1];
+		return (unsigned char)RSTRING_PTR(str)[RSTRING_LEN(str)-1];
 	}
 	rb_thread_wait_fd(fptr->fd);
 	rb_io_check_closed(fptr);
-	if (io_fillbuf(fptr) < 0) {
-	    *lp = limit;
-	    return EOF;
-	}
-    }
+    } while (io_fillbuf(fptr) >= 0);
+    *lp = limit;
+    return EOF;
 }
 
 static inline int

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

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