From 3fedb5128f33390959cfcd97a624b33b0f22f372 Mon Sep 17 00:00:00 2001 From: normal Date: Sat, 11 Oct 2014 06:33:58 +0000 Subject: 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 --- compile.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index dda22b09f6..8df7acfd32 100644 --- a/compile.c +++ b/compile.c @@ -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) { -- cgit v1.2.3