From 3b895e8355b06facb4e80b27e527d560af4fd65a Mon Sep 17 00:00:00 2001 From: ktsj Date: Wed, 30 Jul 2014 13:17:45 +0000 Subject: [PATCH] * process.c (rlimit_resource_type, rlimit_resource_value): get rid of inadvertent dynamic symbol pin-down. * re.c (match_backref_number): ditto. * signal.c (esignal_init, rb_f_kill, trap_signm): ditto. * transcode.c (econv_opts): ditto. * vm_trace.c (symbol2event_flag): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 13 +++++++++++++ process.c | 4 ++-- re.c | 2 +- signal.c | 6 +++--- transcode.c | 2 +- vm_trace.c | 2 +- 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5471bbe2d2..5acf7060cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Wed Jul 30 22:10:29 2014 Kazuki Tsujimoto + + * process.c (rlimit_resource_type, rlimit_resource_value): + get rid of inadvertent dynamic symbol pin-down. + + * re.c (match_backref_number): ditto. + + * signal.c (esignal_init, rb_f_kill, trap_signm): ditto. + + * transcode.c (econv_opts): ditto. + + * vm_trace.c (symbol2event_flag): ditto. + Wed Jul 30 21:29:39 2014 Masaki Suketa * ext/win32ole/win32ole.c (ole_invoke): pass WIN32OLE_RECORD variant diff --git a/process.c b/process.c index cd498fe3cd..e9d1b0638f 100644 --- a/process.c +++ b/process.c @@ -4529,7 +4529,7 @@ rlimit_resource_type(VALUE rtype) switch (TYPE(rtype)) { case T_SYMBOL: - name = rb_id2name(SYM2ID(rtype)); + name = RSTRING_PTR(rb_sym2str(rtype)); break; default: @@ -4564,7 +4564,7 @@ rlimit_resource_value(VALUE rval) switch (TYPE(rval)) { case T_SYMBOL: - name = rb_id2name(SYM2ID(rval)); + name = RSTRING_PTR(rb_sym2str(rval)); break; default: diff --git a/re.c b/re.c index 869fe2e673..4bf18f5e84 100644 --- a/re.c +++ b/re.c @@ -1082,7 +1082,7 @@ match_backref_number(VALUE match, VALUE backref) return NUM2INT(backref); case T_SYMBOL: - name = rb_id2name(SYM2ID(backref)); + name = RSTRING_PTR(rb_sym2str(backref)); break; case T_STRING: diff --git a/signal.c b/signal.c index 01f9686e83..bf1b5d3dfc 100644 --- a/signal.c +++ b/signal.c @@ -301,7 +301,7 @@ esignal_init(int argc, VALUE *argv, VALUE self) } else { int len = sizeof(signame_prefix); - signm = SYMBOL_P(sig) ? rb_id2name(SYM2ID(sig)) : StringValuePtr(sig); + signm = SYMBOL_P(sig) ? RSTRING_PTR(rb_sym2str(sig)) : StringValuePtr(sig); if (strncmp(signm, signame_prefix, len) == 0) { signm += len; len = 0; @@ -408,7 +408,7 @@ rb_f_kill(int argc, const VALUE *argv) break; case T_SYMBOL: - s = rb_id2name(SYM2ID(argv[0])); + s = RSTRING_PTR(rb_sym2str(argv[0])); if (!s) rb_raise(rb_eArgError, "bad signal"); goto str_signal; @@ -1044,7 +1044,7 @@ trap_signm(VALUE vsig) break; case T_SYMBOL: - s = rb_id2name(SYM2ID(vsig)); + s = RSTRING_PTR(rb_sym2str(vsig)); if (!s) rb_raise(rb_eArgError, "bad signal"); goto str_signal; diff --git a/transcode.c b/transcode.c index 5f326fd952..da9b2cc15d 100644 --- a/transcode.c +++ b/transcode.c @@ -2463,7 +2463,7 @@ econv_opts(VALUE opt, int ecflags) ecflags |= ECONV_XML_ATTR_CONTENT_DECORATOR|ECONV_XML_ATTR_QUOTE_DECORATOR|ECONV_UNDEF_HEX_CHARREF; } else if (RB_TYPE_P(v, T_SYMBOL)) { - rb_raise(rb_eArgError, "unexpected value for xml option: %s", rb_id2name(SYM2ID(v))); + rb_raise(rb_eArgError, "unexpected value for xml option: %"PRIsVALUE, rb_sym2str(v)); } else { rb_raise(rb_eArgError, "unexpected value for xml option"); diff --git a/vm_trace.c b/vm_trace.c index 80084019e4..65a53d4d04 100644 --- a/vm_trace.c +++ b/vm_trace.c @@ -700,7 +700,7 @@ symbol2event_flag(VALUE v) #undef C CONST_ID(id, "a_call"); if (sym == ID2SYM(id)) return RUBY_EVENT_CALL | RUBY_EVENT_B_CALL | RUBY_EVENT_C_CALL; CONST_ID(id, "a_return"); if (sym == ID2SYM(id)) return RUBY_EVENT_RETURN | RUBY_EVENT_B_RETURN | RUBY_EVENT_C_RETURN; - rb_raise(rb_eArgError, "unknown event: %s", rb_id2name(SYM2ID(sym))); + rb_raise(rb_eArgError, "unknown event: %"PRIsVALUE, rb_sym2str(sym)); } static rb_tp_t *