vm_trace.c: unified a_call and a_return

* vm_trace.c (symbol2event_flag): use a uniform macro for a_call
  and a_return too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-04-25 23:55:34 +00:00
Родитель 89a2fd52bd
Коммит dc513a13bb
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -684,6 +684,10 @@ symbol2event_flag(VALUE v)
{
ID id;
VALUE sym = rb_convert_type(v, T_SYMBOL, "Symbol", "to_sym");
const rb_event_flag_t RUBY_EVENT_A_CALL =
RUBY_EVENT_CALL | RUBY_EVENT_B_CALL | RUBY_EVENT_C_CALL;
const rb_event_flag_t RUBY_EVENT_A_RETURN =
RUBY_EVENT_RETURN | RUBY_EVENT_B_RETURN | RUBY_EVENT_C_RETURN;
#define C(name, NAME) CONST_ID(id, #name); if (sym == ID2SYM(id)) return RUBY_EVENT_##NAME
C(line, LINE);
@ -699,9 +703,9 @@ symbol2event_flag(VALUE v)
C(thread_begin, THREAD_BEGIN);
C(thread_end, THREAD_END);
C(specified_line, SPECIFIED_LINE);
C(a_call, A_CALL);
C(a_return, A_RETURN);
#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: %"PRIsVALUE, rb_sym2str(sym));
}