[前][次][番号順一覧][スレッド一覧]

ruby-changes:8924

From: nobu <ko1@a...>
Date: Wed, 3 Dec 2008 14:49:22 +0900 (JST)
Subject: [ruby-changes:8924] Ruby:r20460 (trunk): * ext/tk/tcltklib.c (ip_ruby_cmd, ip_invoke_with_position): must

nobu	2008-12-03 14:48:55 +0900 (Wed, 03 Dec 2008)

  New Revision: 20460

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20460

  Log:
    * ext/tk/tcltklib.c (ip_ruby_cmd, ip_invoke_with_position): must
      not access internal union directly.  [ruby-list:45670]

  Modified files:
    trunk/ChangeLog
    trunk/ext/tk/tcltklib.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 20459)
+++ ChangeLog	(revision 20460)
@@ -1,3 +1,8 @@
+Wed Dec  3 14:48:52 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/tk/tcltklib.c (ip_ruby_cmd, ip_invoke_with_position): must
+	  not access internal union directly.  [ruby-list:45670]
+
 Wed Dec  3 12:24:08 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* io.c (rb_io_getc, rb_io_readchar): documentation correction from
Index: ext/tk/tcltklib.c
===================================================================
--- ext/tk/tcltklib.c	(revision 20459)
+++ ext/tk/tcltklib.c	(revision 20460)
@@ -3090,22 +3090,20 @@
     /* get args */
     args = rb_ary_new2(argc - 2);
     for(i = 3; i < argc; i++) {
+        VALUE s;
 #if TCL_MAJOR_VERSION >= 8
         str = Tcl_GetStringFromObj(argv[i], &len);
+        s = rb_tainted_str_new(str, len);
+#else /* TCL_MAJOR_VERSION < 8 */
+        str = argv[i];
+        s = rb_tainted_str_new2(str);
+#endif
         DUMP2("arg:%s",str);
 #ifndef HAVE_STRUCT_RARRAY_LEN
-	rb_ary_push(args, rb_tainted_str_new(str, len));
+        rb_ary_push(args, s);
 #else
-        RARRAY(args)->as.heap.ptr[RARRAY(args)->as.heap.len++] = rb_tainted_str_new(str, len);
+        RARRAY(args)->ptr[RARRAY(args)->len++] = s;
 #endif
-#else /* TCL_MAJOR_VERSION < 8 */
-        DUMP2("arg:%s",argv[i]);
-#ifndef HAVE_STRUCT_RARRAY_LEN
-	rb_ary_push(args, rb_tainted_str_new2(argv[i]));
-#else
-        RARRAY(args)->as.heap.ptr[RARRAY(args)->as.heap.len++] = rb_tainted_str_new2(argv[i]);
-#endif
-#endif
     }
 
     if (old_gc == Qfalse) rb_gc_enable();
@@ -8295,7 +8293,7 @@
     DUMP2("back from handler (current thread:%lx)", current);
 
     /* get result & free allocated memory */
-    ret = RARRAY(result)->as.heap.ptr[0];
+    ret = RARRAY_PTR(result)[0];
 #if 0 /* use Tcl_EventuallyFree */
     Tcl_EventuallyFree((ClientData)alloc_done, TCL_DYNAMIC); /* XXXXXXXX */
 #else

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]