From 23472d2b2a3e12045eb5aa9c8fecd3db9da3def6 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 17 Nov 2009 07:26:26 +0000 Subject: * insns.def (opt_case_dispatch): runtime value cannot be used as an element initializer. * vm_insnhelper.c (opt_case_dispatch_i): gets rid of type-punning calls. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ insns.def | 6 +++--- vm_insnhelper.c | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 98412d78a..d4b5f2bd7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Nov 17 16:26:24 2009 Nobuyoshi Nakada + + * insns.def (opt_case_dispatch): runtime value cannot be used as + an element initializer. + + * vm_insnhelper.c (opt_case_dispatch_i): gets rid of type-punning + calls. Mon Nov 16 15:51:53 2009 Shugo Maeda * vm_insnhelper.c (vm_call_method): protected singleton methods of diff --git a/insns.def b/insns.def index 8be204cea..49522974d 100644 --- a/insns.def +++ b/insns.def @@ -1247,10 +1247,10 @@ opt_case_dispatch } } else { - struct opt_case_dispatch_i_arg arg = { - key, -1 - }; + struct opt_case_dispatch_i_arg arg; + arg.obj = key; + arg.label = -1; st_foreach(RHASH_TBL(hash), opt_case_dispatch_i, (st_data_t)&arg); if (arg.label != -1) { diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 3654e3989..a05574f1d 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1645,9 +1645,9 @@ struct opt_case_dispatch_i_arg { }; static int -opt_case_dispatch_i(st_data_t key, st_data_t data, void *p) +opt_case_dispatch_i(st_data_t key, st_data_t data, st_data_t p) { - struct opt_case_dispatch_i_arg *arg = p; + struct opt_case_dispatch_i_arg *arg = (void *)p; if (RTEST(rb_funcall((VALUE)key, idEqq, 1, arg->obj))) { arg->label = FIX2INT((VALUE)data); -- cgit