[macruby-changes] [574] MacRuby/branches/testing

source_changes at macosforge.org source_changes at macosforge.org
Sun Sep 7 21:03:36 PDT 2008


Revision: 574
          http://trac.macosforge.org/projects/ruby/changeset/574
Author:   lsansonetti at apple.com
Date:     2008-09-07 21:03:35 -0700 (Sun, 07 Sep 2008)
Log Message:
-----------
backport fixes from trunk

Modified Paths:
--------------
    MacRuby/branches/testing/instruby.rb
    MacRuby/branches/testing/io.c

Modified: MacRuby/branches/testing/instruby.rb
===================================================================
--- MacRuby/branches/testing/instruby.rb	2008-09-08 03:53:47 UTC (rev 573)
+++ MacRuby/branches/testing/instruby.rb	2008-09-08 04:03:35 UTC (rev 574)
@@ -527,9 +527,11 @@
     end
   end
   Dir.glob('/System/Library/Frameworks/**/BridgeSupport/*.dylib').each do |p|
-    unless system("./markgc '#{p}' >& /dev/null")
-      $stderr.puts "cannot markgc #{p}"
-      exit 1
+    unless File.exist?(touch_file)
+      unless system("./markgc '#{p}' >& /dev/null")
+        $stderr.puts "cannot markgc #{p}"
+        exit 1
+      end
     end
     unless $destdir.empty?
       dirname = File.dirname(p)

Modified: MacRuby/branches/testing/io.c
===================================================================
--- MacRuby/branches/testing/io.c	2008-09-08 03:53:47 UTC (rev 573)
+++ MacRuby/branches/testing/io.c	2008-09-08 04:03:35 UTC (rev 574)
@@ -712,7 +712,10 @@
     }
 
     len = RSTRING_BYTELEN(str);
-    if ((n = len) <= 0) return n;
+    if ((n = len) <= 0) {
+	RSTRING_SYNC(str);
+	return n;
+    }
     if (fptr->wbuf == NULL && !(fptr->mode & FMODE_SYNC)) {
         fptr->wbuf_off = 0;
         fptr->wbuf_len = 0;
@@ -731,10 +734,14 @@
             fptr->wbuf_len += len;
             n = 0;
         }
-        if (io_fflush(fptr) < 0)
+        if (io_fflush(fptr) < 0) {
+	    RSTRING_SYNC(str);
             return -1L;
-        if (n == 0)
+	}
+        if (n == 0) {
+	    RSTRING_SYNC(str);
             return len;
+	}
         /* avoid context switch between "a" and "\n" in STDERR.puts "a".
            [ruby-dev:25080] */
 	if (fptr->stdio_file != stderr && !rb_thread_fd_writable(fptr->fd)) {
@@ -750,7 +757,10 @@
         }
 	r = rb_write_internal(fptr->fd, RSTRING_BYTEPTR(str)+offset, l);
 	/* xxx: other threads may modify given string. */
-        if (r == n) return len;
+        if (r == n) {
+	    RSTRING_SYNC(str);
+	    return len;
+	}
         if (0 <= r) {
             offset += r;
             n -= r;
@@ -761,6 +771,7 @@
 	    if (offset < RSTRING_BYTELEN(str))
 		goto retry;
         }
+	RSTRING_SYNC(str);
         return -1L;
     }
 
@@ -771,6 +782,7 @@
     }
     MEMMOVE(fptr->wbuf+fptr->wbuf_off+fptr->wbuf_len, RSTRING_BYTEPTR(str)+offset, char, len);
     fptr->wbuf_len += len;
+    RSTRING_SYNC(str);
     return len;
 }
 
@@ -4821,6 +4833,7 @@
             RSTRING_BYTEPTR(line)[RSTRING_BYTELEN(line)-1] != '\n') {
 	    rb_io_write(out, rb_default_rs);
 	}
+	RSTRING_SYNC(line);
     }
 
     return Qnil;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080907/e712aecb/attachment.html 


More information about the macruby-changes mailing list