[macruby-changes] [270] MacRuby/trunk/gc.c

source_changes at macosforge.org source_changes at macosforge.org
Wed Jun 11 13:49:17 PDT 2008


Revision: 270
          http://trac.macosforge.org/projects/ruby/changeset/270
Author:   lsansonetti at apple.com
Date:     2008-06-11 13:49:16 -0700 (Wed, 11 Jun 2008)

Log Message:
-----------
print the gc-not-enabled error in pre GC initialization too

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

Modified: MacRuby/trunk/gc.c
===================================================================
--- MacRuby/trunk/gc.c	2008-06-11 20:48:45 UTC (rev 269)
+++ MacRuby/trunk/gc.c	2008-06-11 20:49:16 UTC (rev 270)
@@ -395,6 +395,16 @@
 
 #if WITH_OBJC
 
+static void
+rb_objc_no_gc_error(void)
+{ 
+    fprintf(stderr,
+	    "The client that links against MacRuby was not built for "\
+	    "GC. Please turn on garbage collection (-fobjc-gc) and "\
+	    "try again.\n");
+    exit(1);
+}
+
 void *
 ruby_xmalloc(size_t size)
 {
@@ -406,13 +416,8 @@
     if (size == 0) size = 1;
     rb_gc_malloc_increase(size);
     
-    if (__auto_zone == NULL) {
-    	fprintf(stderr,
-		"The client that links against MacRuby was not built for "\
-		"GC. Please turn on garbage collection (-fobjc-gc) and "\
-		"try again.\n");
-	exit(1);
-    }
+    if (__auto_zone == NULL)
+	rb_objc_no_gc_error();
     mem = auto_zone_allocate_object(__auto_zone, size, 
 				    AUTO_MEMORY_SCANNED, 0, 0);
     xmalloc_count++;
@@ -3097,6 +3102,10 @@
     auto_collection_control_t *control;
 
     __auto_zone = auto_zone();
+    
+    if (__auto_zone == NULL)
+	rb_objc_no_gc_error();
+    
     //auto_zone_register_thread(__auto_zone);
 
     control = auto_collection_parameters(__auto_zone);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080611/0507f6bf/attachment.htm 


More information about the macruby-changes mailing list