1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
normal 2014-10-11 06:33:58 +00:00
parent 58a73d96b4
commit 3fedb5128f
2 changed files with 10 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Sat Oct 11 15:32:08 2014 Eric Wong <e@80x24.org>
* compile.c (iseq_build_from_ary_exception): move RB_GC_GUARD
(iseq_build_from_ary_body): use PRIsVALUE instead of RB_GC_GUARD
Sat Oct 11 14:57:08 2014 Eric Wong <e@80x24.org>
* string.c (rb_str_intern): remove unnecessary RB_GC_GUARD

View file

@ -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) {