[macruby-changes] [945] MacRuby/branches/experimental/error.c

source_changes at macosforge.org source_changes at macosforge.org
Mon Mar 16 16:54:26 PDT 2009


Revision: 945
          http://trac.macosforge.org/projects/ruby/changeset/945
Author:   lsansonetti at apple.com
Date:     2009-03-16 16:54:25 -0700 (Mon, 16 Mar 2009)
Log Message:
-----------
do not leak the temporary stuff in the message object

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

Modified: MacRuby/branches/experimental/error.c
===================================================================
--- MacRuby/branches/experimental/error.c	2009-03-16 23:00:57 UTC (rev 944)
+++ MacRuby/branches/experimental/error.c	2009-03-16 23:54:25 UTC (rev 945)
@@ -692,7 +692,9 @@
     VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
     VALUE str = mesg;
 
-    if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
+    if (NIL_P(mesg)) {
+	return rb_class_name(CLASS_OF(exc));
+    }
     StringValue(str);
     if (str != mesg) {
 	rb_iv_set(exc, "mesg", mesg = str);
@@ -731,9 +733,9 @@
 {
     VALUE *ptr = ALLOC_N(VALUE, 3);
 
-    ptr[0] = mesg;
-    ptr[1] = recv;
-    ptr[2] = method;
+    GC_WB(&ptr[0], mesg);
+    GC_WB(&ptr[1], recv);
+    GC_WB(&ptr[2], method);
 
     return Data_Wrap_Struct(rb_cNameErrorMesg, NULL, -1, ptr);
 }
@@ -802,7 +804,9 @@
 	args[2] = d;
 	mesg = rb_f_sprintf(3, args);
     }
-    if (OBJ_TAINTED(obj)) OBJ_TAINT(mesg);
+    if (OBJ_TAINTED(obj)) {
+	OBJ_TAINT(mesg);
+    }
     return mesg;
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090316/2174bb99/attachment-0001.html>


More information about the macruby-changes mailing list