[576] MacRuby/trunk/io.c
Revision: 576 http://trac.macosforge.org/projects/ruby/changeset/576 Author: lsansonetti@apple.com Date: 2008-09-07 23:36:47 -0700 (Sun, 07 Sep 2008) Log Message: ----------- fixed a bug introduced by the latest commit Modified Paths: -------------- MacRuby/trunk/io.c Modified: MacRuby/trunk/io.c =================================================================== --- MacRuby/trunk/io.c 2008-09-08 06:36:41 UTC (rev 575) +++ MacRuby/trunk/io.c 2008-09-08 06:36:47 UTC (rev 576) @@ -711,9 +711,8 @@ } } - len = RSTRING_BYTELEN(str); + len = RSTRING_LEN(str); if ((n = len) <= 0) { - RSTRING_SYNC(str); return n; } if (fptr->wbuf == NULL && !(fptr->mode & FMODE_SYNC)) { @@ -730,16 +729,14 @@ MEMMOVE(fptr->wbuf, fptr->wbuf+fptr->wbuf_off, char, fptr->wbuf_len); fptr->wbuf_off = 0; } - MEMMOVE(fptr->wbuf+fptr->wbuf_off+fptr->wbuf_len, RSTRING_BYTEPTR(str)+offset, char, len); + MEMMOVE(fptr->wbuf+fptr->wbuf_off+fptr->wbuf_len, RSTRING_PTR(str)+offset, char, len); fptr->wbuf_len += len; n = 0; } if (io_fflush(fptr) < 0) { - RSTRING_SYNC(str); return -1L; } if (n == 0) { - RSTRING_SYNC(str); return len; } /* avoid context switch between "a" and "\n" in STDERR.puts "a". @@ -755,10 +752,9 @@ wsplit_p(fptr)) { l = PIPE_BUF; } - r = rb_write_internal(fptr->fd, RSTRING_BYTEPTR(str)+offset, l); + r = rb_write_internal(fptr->fd, ((char *)RSTRING_PTR(str))+offset, l); /* xxx: other threads may modify given string. */ if (r == n) { - RSTRING_SYNC(str); return len; } if (0 <= r) { @@ -768,10 +764,9 @@ } if (rb_io_wait_writable(fptr->fd)) { rb_io_check_closed(fptr); - if (offset < RSTRING_BYTELEN(str)) + if (offset < RSTRING_LEN(str)) goto retry; } - RSTRING_SYNC(str); return -1L; } @@ -780,9 +775,8 @@ MEMMOVE(fptr->wbuf, fptr->wbuf+fptr->wbuf_off, char, fptr->wbuf_len); fptr->wbuf_off = 0; } - MEMMOVE(fptr->wbuf+fptr->wbuf_off+fptr->wbuf_len, RSTRING_BYTEPTR(str)+offset, char, len); + MEMMOVE(fptr->wbuf+fptr->wbuf_off+fptr->wbuf_len, RSTRING_PTR(str)+offset, char, len); fptr->wbuf_len += len; - RSTRING_SYNC(str); return len; } @@ -4829,11 +4823,10 @@ } line = rb_obj_as_string(argv[i]); rb_io_write(out, line); - if (RSTRING_BYTELEN(line) == 0 || - RSTRING_BYTEPTR(line)[RSTRING_BYTELEN(line)-1] != '\n') { + if (RSTRING_LEN(line) == 0 || + RSTRING_PTR(line)[RSTRING_LEN(line)-1] != '\n') { rb_io_write(out, rb_default_rs); } - RSTRING_SYNC(line); } return Qnil;
participants (1)
-
source_changes@macosforge.org