ruby-changes:34614
From: nobu <ko1@a...>
Date: Sat, 5 Jul 2014 02:27:24 +0900 (JST)
Subject: [ruby-changes:34614] nobu:r46697 (trunk): parse.y: fix casts
nobu 2014-07-05 02:27:08 +0900 (Sat, 05 Jul 2014) New Revision: 46697 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46697 Log: parse.y: fix casts * parse.y (reg_named_capture_assign_gen): remove needless cast. * parse.y (must_be_dynamic_symbol, intern_cstr_without_pindown): get rid of type-punning cast. Modified files: trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 46696) +++ parse.y (revision 46697) @@ -9999,7 +9999,7 @@ reg_named_capture_assign_gen(struct pars https://github.com/ruby/ruby/blob/trunk/parse.y#L9999 arg.succ_block = 0; arg.fail_block = 0; arg.num = 0; - onig_foreach_name(RREGEXP(regexp)->ptr, reg_named_capture_assign_iter, (void*)&arg); + onig_foreach_name(RREGEXP(regexp)->ptr, reg_named_capture_assign_iter, &arg); if (arg.num == 0) return match; @@ -10419,10 +10419,10 @@ must_be_dynamic_symbol(VALUE x) https://github.com/ruby/ruby/blob/trunk/parse.y#L10419 { if (UNLIKELY(!DYNAMIC_SYM_P(x))) { if (STATIC_SYM_P(x)) { - VALUE str; + st_data_t str; - if (lookup_id_str(RSHIFT((unsigned long)(x),RUBY_SPECIAL_SHIFT), (st_data_t *)&str)) { - rb_bug("wrong argument: %s (inappropriate Symbol)", RSTRING_PTR(str)); + if (lookup_id_str(RSHIFT((unsigned long)(x),RUBY_SPECIAL_SHIFT), &str)) { + rb_bug("wrong argument: %s (inappropriate Symbol)", RSTRING_PTR((VALUE)str)); } else { rb_bug("wrong argument: inappropriate Symbol (%p)", (void *)x); @@ -10475,14 +10475,14 @@ lookup_str_id(st_data_t str, st_data_t * https://github.com/ruby/ruby/blob/trunk/parse.y#L10475 static ID intern_cstr_without_pindown(const char *name, long len, rb_encoding *enc) { - ID id; + st_data_t id; struct RString fake_str; VALUE str = setup_fake_str(&fake_str, name, len); rb_enc_associate(str, enc); OBJ_FREEZE(str); - if (st_lookup(global_symbols.str_id, str, (st_data_t *)&id)) { - return id; + if (st_lookup(global_symbols.str_id, str, &id)) { + return (ID)id; } str = rb_enc_str_new(name, len, enc); /* make true string */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/