[macruby-changes] [4237] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Jun 17 17:21:04 PDT 2010


Revision: 4237
          http://trac.macosforge.org/projects/ruby/changeset/4237
Author:   lsansonetti at apple.com
Date:     2010-06-17 17:21:00 -0700 (Thu, 17 Jun 2010)
Log Message:
-----------
cleaning up a few things

Modified Paths:
--------------
    MacRuby/trunk/bridgesupport.cpp
    MacRuby/trunk/env.c
    MacRuby/trunk/eval.c
    MacRuby/trunk/include/ruby/io.h
    MacRuby/trunk/io.c
    MacRuby/trunk/objc.m
    MacRuby/trunk/proc.c
    MacRuby/trunk/variable.c

Modified: MacRuby/trunk/bridgesupport.cpp
===================================================================
--- MacRuby/trunk/bridgesupport.cpp	2010-06-17 23:58:04 UTC (rev 4236)
+++ MacRuby/trunk/bridgesupport.cpp	2010-06-18 00:21:00 UTC (rev 4237)
@@ -1528,7 +1528,7 @@
 #endif
 
     bs_const_magic_cookie = rb_str_new2("bs_const_magic_cookie");
-    rb_objc_retain((void *)bs_const_magic_cookie);
+    GC_RETAIN(bs_const_magic_cookie);
 }
 
 extern "C"

Modified: MacRuby/trunk/env.c
===================================================================
--- MacRuby/trunk/env.c	2010-06-17 23:58:04 UTC (rev 4236)
+++ MacRuby/trunk/env.c	2010-06-18 00:21:00 UTC (rev 4237)
@@ -15,7 +15,7 @@
 #include "ruby/node.h"
 #include "vm.h"
 
-#include <crt_externs.h>
+char ***_NSGetEnviron();
 
 static VALUE envtbl;
 

Modified: MacRuby/trunk/eval.c
===================================================================
--- MacRuby/trunk/eval.c	2010-06-17 23:58:04 UTC (rev 4236)
+++ MacRuby/trunk/eval.c	2010-06-18 00:21:00 UTC (rev 4237)
@@ -882,5 +882,5 @@
 
     exception_error = rb_exc_new2(rb_eFatal, "exception reentered");
     //rb_ivar_set(exception_error, idThrowState, INT2FIX(TAG_FATAL));
-    rb_objc_retain((void *)exception_error);
+    GC_RETAIN(exception_error);
 }

Modified: MacRuby/trunk/include/ruby/io.h
===================================================================
--- MacRuby/trunk/include/ruby/io.h	2010-06-17 23:58:04 UTC (rev 4236)
+++ MacRuby/trunk/include/ruby/io.h	2010-06-18 00:21:00 UTC (rev 4237)
@@ -22,6 +22,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <spawn.h>
+#include <fcntl.h>
 #include "ruby/encoding.h"
 
 typedef struct rb_io_t {

Modified: MacRuby/trunk/io.c
===================================================================
--- MacRuby/trunk/io.c	2010-06-17 23:58:04 UTC (rev 4236)
+++ MacRuby/trunk/io.c	2010-06-18 00:21:00 UTC (rev 4237)
@@ -30,8 +30,9 @@
 #include <sys/param.h>
 #include <sys/syscall.h>
 #include <spawn.h>
-#include <crt_externs.h>
 
+char ***_NSGetEnviron();
+
 extern void Init_File(void);
 
 VALUE rb_cIO;
@@ -1114,8 +1115,7 @@
     
     uint8_t *bytes = rb_bstr_bytes(buffer);
     
-    long r;
-    r = read(io->read_fd, bytes, (size_t)to_read);
+    const long r = read(io->read_fd, bytes, (size_t)to_read);
     if (r == -1) {
 	rb_sys_fail("read(2) failed.");
     }

Modified: MacRuby/trunk/objc.m
===================================================================
--- MacRuby/trunk/objc.m	2010-06-17 23:58:04 UTC (rev 4236)
+++ MacRuby/trunk/objc.m	2010-06-18 00:21:00 UTC (rev 4237)
@@ -130,41 +130,6 @@
     return false;
 }
 
-static id _symbolicator = nil;
-#define SYMBOLICATION_FRAMEWORK @"/System/Library/PrivateFrameworks/Symbolication.framework"
-
-typedef struct _VMURange {
-    uint64_t location;
-    uint64_t length;
-} VMURange;
-
- at interface NSObject (SymbolicatorAPIs) 
-- (id)symbolicatorForTask:(mach_port_t)task;
-- (id)symbolForAddress:(uint64_t)address;
-- (void)forceFullSymbolExtraction;
-- (VMURange)addressRange;
- at end
-
-static inline id
-rb_objc_symbolicator(void) 
-{
-    if (_symbolicator == nil) {
-	NSError *error;
-
-	if (![[NSBundle bundleWithPath:SYMBOLICATION_FRAMEWORK]
-		loadAndReturnError:&error]) {
-	    NSLog(@"Cannot load Symbolication.framework: %@", error);
-	    abort();    
-	}
-
-	Class VMUSymbolicator = NSClassFromString(@"VMUSymbolicator");
-	_symbolicator = [VMUSymbolicator symbolicatorForTask:mach_task_self()];
-	assert(_symbolicator != nil);
-    }
-
-    return _symbolicator;
-}
-
 bool
 rb_objc_symbolize_address(void *addr, void **start, char *name,
 			  size_t name_len) 
@@ -182,23 +147,7 @@
 	}
     }
 
-#if 1
     return false;
-#else
-    id symbolicator = rb_objc_symbolicator();
-    id symbol = [symbolicator symbolForAddress:(NSUInteger)addr];
-    if (symbol == nil) {
-	return false;
-    }
-    VMURange range = [symbol addressRange];
-    if (start != NULL) {
-	*start = (void *)(NSUInteger)range.location;
-    }
-    if (name != NULL) {
-	strncpy(name, [[symbol name] UTF8String], name_len);
-    }
-    return true;
-#endif
 }
 
 VALUE
@@ -241,7 +190,7 @@
     if (is_absolute_path(res, !absolute)) {
 	NSString *tmp = [res stringByResolvingSymlinksInPath];
 	// Make sure we don't have an invalid user path.
-	if ([res hasPrefix:@"~"] && [tmp isEqualTo:res]) {
+	if ([res hasPrefix:@"~"] && [tmp isEqualToString:res]) {
 	    NSString *user = [[[res pathComponents] objectAtIndex:0]
 		substringFromIndex:1];
 	    rb_raise(rb_eArgError, "user %s doesn't exist", [user UTF8String]);
@@ -258,7 +207,7 @@
 	}
 
 	// stringByStandardizingPath does not expand "/." to "/".
-	if ([res isEqualTo:@"."] && [dir isEqualTo:@"/"]) {
+	if ([res isEqualToString:@"."] && [dir isEqualToString:@"/"]) {
 	    res = @"/";
 	}
 	else {

Modified: MacRuby/trunk/proc.c
===================================================================
--- MacRuby/trunk/proc.c	2010-06-17 23:58:04 UTC (rev 4236)
+++ MacRuby/trunk/proc.c	2010-06-18 00:21:00 UTC (rev 4237)
@@ -1514,7 +1514,7 @@
     rb_eSysStackError = rb_define_class("SystemStackError", rb_eException);
     sysstack_error = rb_exc_new2(rb_eSysStackError, "stack level too deep");
     OBJ_TAINT(sysstack_error);
-    rb_objc_retain((void *)sysstack_error);
+    GC_RETAIN(sysstack_error);
 
     /* utility functions */
     rb_objc_define_module_function(rb_mKernel, "proc", rb_block_proc_imp, 0);

Modified: MacRuby/trunk/variable.c
===================================================================
--- MacRuby/trunk/variable.c	2010-06-17 23:58:04 UTC (rev 4236)
+++ MacRuby/trunk/variable.c	2010-06-18 00:21:00 UTC (rev 4237)
@@ -65,9 +65,9 @@
 Init_var_tables(void)
 {
     rb_global_tbl = st_init_numtable();
-    rb_objc_retain(rb_global_tbl);
+    GC_RETAIN(rb_global_tbl);
     rb_class_tbl = st_init_numtable();
-    rb_objc_retain(rb_class_tbl);
+    GC_RETAIN(rb_class_tbl);
     autoload = rb_intern("__autoload__");
     classpath = rb_intern("__classpath__");
     tmp_classpath = rb_intern("__tmp_classpath__");
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100617/a187ed4c/attachment-0001.html>


More information about the macruby-changes mailing list