[macruby-changes] [4203] MacRuby/trunk/bridgesupport.cpp

source_changes at macosforge.org source_changes at macosforge.org
Fri Jun 4 17:02:33 PDT 2010


Revision: 4203
          http://trac.macosforge.org/projects/ruby/changeset/4203
Author:   martinlagardette at apple.com
Date:     2010-06-04 17:02:31 -0700 (Fri, 04 Jun 2010)
Log Message:
-----------
Do not allow creation of pointer to "`v`"

Modified Paths:
--------------
    MacRuby/trunk/bridgesupport.cpp

Modified: MacRuby/trunk/bridgesupport.cpp
===================================================================
--- MacRuby/trunk/bridgesupport.cpp	2010-06-04 18:59:07 UTC (rev 4202)
+++ MacRuby/trunk/bridgesupport.cpp	2010-06-05 00:02:31 UTC (rev 4203)
@@ -745,12 +745,6 @@
 rb_pointer_init_type(rb_vm_pointer_t *ptr, VALUE type)
 {
     const char *type_str = StringValuePtr(type);
-    // LLVM doesn't allow to get a pointer to Type::VoidTy, and for convenience
-    // reasons we map a pointer to void as a pointer to unsigned char.
-    if (*type_str == 'v') {
-	type_str = "C";
-	type = rb_str_new2(type_str);
-    }
 
     GC_WB(&ptr->type, type);
 
@@ -826,6 +820,10 @@
     }
 
     const char *type_str = convert_ffi_type(type, false);
+    // There's no such thing as void type in ruby
+    if (*type_str == 'v') {
+	rb_raise(rb_eTypeError, "Void pointer is not allowed");
+    }
 
     return rb_pointer_new(type_str,
 	    xmalloc(GET_CORE()->get_sizeof(type_str) * rlen), rlen);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100604/cbd29f3d/attachment.html>


More information about the macruby-changes mailing list