[macruby-changes] [828] MacRuby/trunk/io.c

source_changes at macosforge.org source_changes at macosforge.org
Sun Mar 1 19:35:35 PST 2009


Revision: 828
          http://trac.macosforge.org/projects/ruby/changeset/828
Author:   lsansonetti at apple.com
Date:     2009-03-01 19:35:33 -0800 (Sun, 01 Mar 2009)
Log Message:
-----------
fixed another GC/IO bug

Modified Paths:
--------------
    MacRuby/trunk/io.c

Modified: MacRuby/trunk/io.c
===================================================================
--- MacRuby/trunk/io.c	2009-03-01 22:42:14 UTC (rev 827)
+++ MacRuby/trunk/io.c	2009-03-02 03:35:33 UTC (rev 828)
@@ -6961,28 +6961,32 @@
 rb_io_s_copy_stream(int argc, VALUE *argv, VALUE io)
 {
     VALUE src, dst, length, src_offset;
-    struct copy_stream_struct st;
+    struct copy_stream_struct *st;
 
-    MEMZERO(&st, struct copy_stream_struct, 1);
+    st = xmalloc(sizeof(struct copy_stream_struct));
 
     rb_scan_args(argc, argv, "22", &src, &dst, &length, &src_offset);
 
-    st.src = src;
-    st.dst = dst;
+    st->src = src;
+    st->dst = dst;
 
-    if (NIL_P(length))
-        st.copy_length = (off_t)-1;
-    else
-        st.copy_length = NUM2OFFT(length);
+    if (NIL_P(length)) {
+        st->copy_length = (off_t)-1;
+    }
+    else {
+        st->copy_length = NUM2OFFT(length);
+    }
 
-    if (NIL_P(src_offset))
-        st.src_offset = (off_t)-1;
-    else
-        st.src_offset = NUM2OFFT(src_offset);
+    if (NIL_P(src_offset)) {
+        st->src_offset = (off_t)-1;
+    }
+    else {
+        st->src_offset = NUM2OFFT(src_offset);
+    }
 
-    rb_ensure(copy_stream_body, (VALUE)&st, copy_stream_finalize, (VALUE)&st);
+    rb_ensure(copy_stream_body, (VALUE)st, copy_stream_finalize, (VALUE)st);
 
-    return OFFT2NUM(st.total);
+    return OFFT2NUM(st->total);
 }
 
 /*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090301/c4bcbf58/attachment.html>


More information about the macruby-changes mailing list