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

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 6 14:48:56 PDT 2010


Revision: 4582
          http://trac.macosforge.org/projects/ruby/changeset/4582
Author:   lsansonetti at apple.com
Date:     2010-10-06 14:48:55 -0700 (Wed, 06 Oct 2010)
Log Message:
-----------
avoid sanity pointer type comparison check in case the given pointer type is 'C'

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

Modified: MacRuby/trunk/bridgesupport.cpp
===================================================================
--- MacRuby/trunk/bridgesupport.cpp	2010-10-05 22:26:01 UTC (rev 4581)
+++ MacRuby/trunk/bridgesupport.cpp	2010-10-06 21:48:55 UTC (rev 4582)
@@ -1532,13 +1532,18 @@
 
     rb_vm_pointer_t *ptr;
     Data_Get_Struct(rcv, rb_vm_pointer_t, ptr);
+    const char *ptr_type = RSTRING_PTR(ptr->type);
 
     assert(type[0] == _C_PTR);
-    if (type[1] != _C_VOID && strcmp(RSTRING_PTR(ptr->type), &type[1]) != 0) {
+    // Sanity pointer type comparison check, unless the given pointer type
+    // is 'C' (which means converted from void*) or the target argument pointer
+    // type is void*.
+    if (type[1] != _C_VOID && ptr_type[0] != _C_UCHR
+	    && strcmp(ptr_type, &type[1]) != 0) {
 	rb_raise(rb_eTypeError,
 		"expected instance of Pointer of type `%s', got `%s'",
 		type + 1,
-		RSTRING_PTR(ptr->type));
+		ptr_type);
     }
 
     return ptr->val;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101006/49007bb7/attachment.html>


More information about the macruby-changes mailing list