diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-07 23:10:55 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-07 23:10:55 +0000 |
commit | 1dd547fe5a3eca165488d6ac5951c61069b7f9c6 (patch) | |
tree | 5f941d0be819a4b9dead341dad69764dddbc6088 /vm_trace.c | |
parent | d7924abf5d1b39ec54620d51f1c9d30cd01f73fe (diff) |
* vm_trace.c (exec_hooks_precheck): check need_clean everytime
to clean-up unused hooks.
* vm_trace.c (list->need_clean): use as boolean value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_trace.c')
-rw-r--r-- | vm_trace.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/vm_trace.c b/vm_trace.c index ff2118384a..0515abf7ab 100644 --- a/vm_trace.c +++ b/vm_trace.c @@ -171,7 +171,7 @@ remove_event_hook(rb_hook_list_t *list, rb_event_hook_func_t func, VALUE data) if (data == Qundef || hook->data == data) { hook->hook_flags |= RUBY_EVENT_HOOK_FLAG_DELETED; ret+=1; - list->need_clean++; + list->need_clean = TRUE; } } hook = hook->next; @@ -230,7 +230,7 @@ clean_hooks(rb_hook_list_t *list) rb_event_hook_t *hook, **nextp = &list->hooks; list->events = 0; - list->need_clean = 0; + list->need_clean = FALSE; while ((hook = *nextp) != 0) { if (hook->hook_flags & RUBY_EVENT_HOOK_FLAG_DELETED) { @@ -265,14 +265,13 @@ exec_hooks_body(rb_thread_t *th, rb_hook_list_t *list, const rb_trace_arg_t *tra static int exec_hooks_precheck(rb_thread_t *th, rb_hook_list_t *list, const rb_trace_arg_t *trace_arg) { - if ((list->events & trace_arg->event) == 0) return 0; - - if (UNLIKELY(list->need_clean > 0)) { + if (UNLIKELY(list->need_clean != FALSE)) { if (th->vm->trace_running <= 1) { /* only running this hooks */ clean_hooks(list); } } - return 1; + + return (list->events & trace_arg->event) != 0; } static void |