[macruby-changes] [915] MacRuby/branches/experimental/io.c

source_changes at macosforge.org source_changes at macosforge.org
Fri Mar 13 20:53:50 PDT 2009


Revision: 915
          http://trac.macosforge.org/projects/ruby/changeset/915
Author:   lsansonetti at apple.com
Date:     2009-03-13 20:53:50 -0700 (Fri, 13 Mar 2009)
Log Message:
-----------
cleaner readlines

Modified Paths:
--------------
    MacRuby/branches/experimental/io.c

Modified: MacRuby/branches/experimental/io.c
===================================================================
--- MacRuby/branches/experimental/io.c	2009-03-14 03:40:01 UTC (rev 914)
+++ MacRuby/branches/experimental/io.c	2009-03-14 03:53:50 UTC (rev 915)
@@ -3064,20 +3064,11 @@
 
 	long pos = 0;
 	void *ptr;
-	do {
-	    ptr = memchr(&buf[pos], byte, length - pos);
-	    long s;
-	    if (ptr == NULL) {
-		// Remaining data.
-		s = length - pos;
-	    }
-	    else {
-		s =  (long)ptr - (long)&buf[pos] + 1;
-	    }
+	while ((ptr = memchr(&buf[pos], byte, length - pos)) != NULL) {
+	    const long s =  (long)ptr - (long)&buf[pos] + 1;
 	    rb_ary_push(ary, rb_bytestring_new_with_data(&buf[pos], s));
 	    pos += s; 
 	}
-	while (ptr != NULL);
     }
     else {
 	// TODO
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090313/33ae8055/attachment.html>


More information about the macruby-changes mailing list