diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ext/tk/tcltklib.c | 20 |
2 files changed, 14 insertions, 11 deletions
@@ -1,3 +1,8 @@ +Wed Dec 3 14:48:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * 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@ruby-lang.org> * io.c (rb_io_getc, rb_io_readchar): documentation correction from diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c index 34b66f76e6..dadab2f221 100644 --- a/ext/tk/tcltklib.c +++ b/ext/tk/tcltklib.c @@ -3090,21 +3090,19 @@ ip_ruby_cmd(clientData, interp, argc, argv) /* 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); - DUMP2("arg:%s",str); -#ifndef HAVE_STRUCT_RARRAY_LEN - rb_ary_push(args, rb_tainted_str_new(str, len)); -#else - RARRAY(args)->as.heap.ptr[RARRAY(args)->as.heap.len++] = rb_tainted_str_new(str, len); -#endif + s = rb_tainted_str_new(str, len); #else /* TCL_MAJOR_VERSION < 8 */ - DUMP2("arg:%s",argv[i]); + 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_new2(argv[i])); + rb_ary_push(args, s); #else - RARRAY(args)->as.heap.ptr[RARRAY(args)->as.heap.len++] = rb_tainted_str_new2(argv[i]); -#endif + RARRAY(args)->ptr[RARRAY(args)->len++] = s; #endif } @@ -8295,7 +8293,7 @@ ip_invoke_with_position(argc, argv, obj, position) 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 |