[macruby-changes] [2460] MacRuby/trunk/marshal.c

source_changes at macosforge.org source_changes at macosforge.org
Thu Sep 3 13:38:49 PDT 2009


Revision: 2460
          http://trac.macosforge.org/projects/ruby/changeset/2460
Author:   lsansonetti at apple.com
Date:     2009-09-03 13:38:47 -0700 (Thu, 03 Sep 2009)
Log Message:
-----------
force bytestring creation + fixed the coding style

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

Modified: MacRuby/trunk/marshal.c
===================================================================
--- MacRuby/trunk/marshal.c	2009-09-03 20:20:11 UTC (rev 2459)
+++ MacRuby/trunk/marshal.c	2009-09-03 20:38:47 UTC (rev 2460)
@@ -946,19 +946,29 @@
     arg = (struct dump_arg *)xmalloc(sizeof(struct dump_arg));
     c_arg = (struct dump_call_arg *)xmalloc(sizeof(struct dump_call_arg));
     if (argc == 3) {
-	if (!NIL_P(a2)) limit = NUM2INT(a2);
-	if (NIL_P(a1)) goto type_error;
+	if (!NIL_P(a2)) {
+	    limit = NUM2INT(a2);
+	}
+	if (NIL_P(a1)) {
+	    goto type_error;
+	}
 	port = a1;
     }
     else if (argc == 2) {
-	if (FIXNUM_P(a1)) limit = FIX2INT(a1);
-	else if (NIL_P(a1)) goto type_error;
-	else port = a1;
+	if (FIXNUM_P(a1)) {
+	    limit = FIX2INT(a1);
+	}
+	else if (NIL_P(a1)) {
+	    goto type_error;
+	}
+	else {
+	    port = a1;
+	}
     }
     arg->dest = 0;
     if (!NIL_P(port)) {
 	if (!rb_obj_respond_to(port, s_write, Qtrue)) {
-	  type_error:
+type_error:
 	    rb_raise(rb_eTypeError, "instance of IO needed");
 	}
 	GC_WB(&arg->str, rb_str_buf_new(0));
@@ -968,7 +978,7 @@
 	}
     }
     else {
-	port = rb_str_buf_new(0);
+	port = rb_bytestring_new();
 	GC_WB(&arg->str, port);
     }
 
@@ -977,7 +987,7 @@
 
     GC_WB(&arg->symbols, st_init_numtable());
     GC_WB(&arg->data, st_init_numtable());
-    arg->taint   = Qfalse;
+    arg->taint = Qfalse;
     GC_WB(&arg->compat_tbl, st_init_numtable());
     GC_WB(&arg->wrapper, Data_Wrap_Struct(rb_cData, mark_dump_arg, 0, arg));
     arg->encodings = 0;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090903/87b654c7/attachment.html>


More information about the macruby-changes mailing list