diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-11 06:33:58 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-11 06:33:58 +0000 |
commit | 3fedb5128f33390959cfcd97a624b33b0f22f372 (patch) | |
tree | 7596b598c4219744135eda588931b93f4bc2d339 /compile.c | |
parent | 58a73d96b44de66c7a665e08374391adcad5239c (diff) |
compile.c: fix RB_GC_GUARD usage
* compile.c (iseq_build_from_ary_exception): move RB_GC_GUARD
(iseq_build_from_ary_body): use PRIsVALUE instead of RB_GC_GUARD
Currently unused functions, but we should set good examples for
using RB_GC_GUARD (and favoring PRIsVALUE in format strings).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -5567,7 +5567,7 @@ iseq_build_from_ary_exception(rb_iseq_t *iseq, struct st_table *labels_table, LABEL *lstart, *lend, *lcont; int sp; - RB_GC_GUARD(v) = rb_convert_type(RARRAY_AREF(exception, i), T_ARRAY, + v = rb_convert_type(RARRAY_AREF(exception, i), T_ARRAY, "Array", "to_ary"); if (RARRAY_LEN(v) != 6) { rb_raise(rb_eSyntaxError, "wrong exception entry"); @@ -5589,6 +5589,8 @@ iseq_build_from_ary_exception(rb_iseq_t *iseq, struct st_table *labels_table, (void)sp; ADD_CATCH_ENTRY(type, lstart, lend, eiseqval, lcont); + + RB_GC_GUARD(v); } return COMPILE_OK; } @@ -5662,9 +5664,9 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor, insn = (argc < 0) ? Qnil : RARRAY_AREF(obj, 0); if (st_lookup(insn_table, (st_data_t)insn, &insn_id) == 0) { /* TODO: exception */ - RB_GC_GUARD(insn) = rb_inspect(insn); rb_compile_error(RSTRING_PTR(iseq->location.path), line_no, - "unknown instruction: %s", RSTRING_PTR(insn)); + "unknown instruction: %"PRIsVALUE, + rb_inspect(insn)); } if (argc != insn_len((VALUE)insn_id)-1) { |