diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-03-30 21:55:59 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-03-30 21:55:59 +0000 |
commit | a92374677c683e78ba24013c6c7d60bf133e0c26 (patch) | |
tree | 441bc46376c8fc29c66826a6d244d9ee6ad3f412 /gc.c | |
parent | 1cd98eb928339ac50e5b309eccfab928f350e1b9 (diff) | |
download | ruby-a92374677c683e78ba24013c6c7d60bf133e0c26.tar.gz |
gc.c: avoid inadvertent pin-down
* gc.c (gc_info_decode): get rid of inadvertent dynamic symbol
pin-down, and preserve encoding in error messages. also should
not use RSTRING_PTR macro on function calls.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -5325,8 +5325,9 @@ gc_info_decode(int flags, VALUE hash_or_key) SET(immediate_sweep, (flags & GPR_FLAG_IMMEDIATE_SWEEP) ? Qtrue : Qfalse); #undef SET - if (key != Qnil) /* matched key should return above */ - rb_raise(rb_eArgError, "unknown key: %s", RSTRING_PTR(rb_id2str(SYM2ID(key)))); + if (!NIL_P(key)) {/* matched key should return above */ + rb_raise(rb_eArgError, "unknown key: %"PRIsVALUE, rb_sym2str(key)); + } return hash; } @@ -5486,8 +5487,9 @@ gc_stat_internal(VALUE hash_or_sym, size_t *out) #endif /* USE_RGENGC */ #undef SET - if (key != Qnil) /* matched key should return above */ - rb_raise(rb_eArgError, "unknown key: %s", RSTRING_PTR(rb_id2str(SYM2ID(key)))); + if (!NIL_P(key)) { /* matched key should return above */ + rb_raise(rb_eArgError, "unknown key: %"PRIsVALUE, rb_sym2str(key)); + } #if defined(RGENGC_PROFILE) && RGENGC_PROFILE >= 2 if (hash != Qnil) { |