[macruby-changes] [140] MacRuby/trunk/parse.y

source_changes at macosforge.org source_changes at macosforge.org
Tue Apr 15 23:47:28 PDT 2008


Revision: 140
          http://trac.macosforge.org/projects/ruby/changeset/140
Author:   lsansonetti at apple.com
Date:     2008-04-15 23:47:27 -0700 (Tue, 15 Apr 2008)

Log Message:
-----------
fixed setter symbols

Modified Paths:
--------------
    MacRuby/trunk/parse.y

Modified: MacRuby/trunk/parse.y
===================================================================
--- MacRuby/trunk/parse.y	2008-04-16 00:54:17 UTC (rev 139)
+++ MacRuby/trunk/parse.y	2008-04-16 06:47:27 UTC (rev 140)
@@ -9129,6 +9129,12 @@
     if (st_lookup(global_symbols.sym_id, str, (st_data_t *)&id))
 	return id;
 #else
+    if (strlen(name) != len) {
+	char *tmp = (char *)alloca(len + 1);
+        memcpy(tmp, name, len);
+        tmp[len] = '\0';
+        name = tmp;
+    }
     SEL name_hash = sel_registerName(name);
     id = (ID)CFDictionaryGetValue((CFDictionaryRef)global_symbols.sym_id, 
 	(const void *)name_hash);
@@ -9258,7 +9264,7 @@
     else {
 	enc = rb_enc_get(str);
     }
-    id = rb_intern3(RSTRING_PTR(str), RSTRING_LEN(str), enc);
+    id = rb_intern3(RSTRING_CPTR(str), RSTRING_CLEN(str), enc);
     RB_GC_GUARD(str);
     return id;
 }
@@ -9312,14 +9318,11 @@
 	rb_str_cat(str, "=", 1);
 	rb_intern_str(str);
 #if WITH_OBJC
-	return str;
-# if 0
 	data = (VALUE)CFDictionaryGetValue(
 	    (CFDictionaryRef)global_symbols.id_str,
 	    (const void *)id);
 	if (data != 0)
 	    return data;
-# endif
 #else
 	if (st_lookup(global_symbols.id_str, id, &data)) {
             VALUE str = (VALUE)data;
@@ -9338,7 +9341,7 @@
     VALUE str = rb_id2str(id);
 
     if (!str) return 0;
-    return RSTRING_PTR(str);
+    return RSTRING_CPTR(str);
 }
 
 static int

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080415/362b2502/attachment.html


More information about the macruby-changes mailing list