diff options
author | S.H <[email protected]> | 2021-08-02 12:06:44 +0900 |
---|---|---|
committer | GitHub <[email protected]> | 2021-08-02 12:06:44 +0900 |
commit | 378e8cdad69e6ba995a024da2957719789f0679e (patch) | |
tree | 99ffe0f8055bc10cba3225fb5e7a906f5c3f4543 /thread.c | |
parent | 3688b476710def7290e32656b200fefc538366d0 (diff) |
Using RBOOL macro
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4695
Merged-By: nobu <[email protected]>
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 34 |
1 files changed, 10 insertions, 24 deletions
@@ -2303,12 +2303,7 @@ rb_thread_pending_interrupt_p(int argc, VALUE *argv, VALUE target_thread) if (!rb_obj_is_kind_of(err, rb_cModule)) { rb_raise(rb_eTypeError, "class or module required for rescue clause"); } - if (rb_threadptr_pending_interrupt_include_p(target_th, err)) { - return Qtrue; - } - else { - return Qfalse; - } + return RBOOL(rb_threadptr_pending_interrupt_include_p(target_th, err)); } else { return Qtrue; @@ -2955,7 +2950,7 @@ rb_thread_s_main(VALUE klass) static VALUE rb_thread_s_abort_exc(VALUE _) { - return GET_THREAD()->vm->thread_abort_on_exception ? Qtrue : Qfalse; + return RBOOL(GET_THREAD()->vm->thread_abort_on_exception); } @@ -3015,7 +3010,7 @@ rb_thread_s_abort_exc_set(VALUE self, VALUE val) static VALUE rb_thread_abort_exc(VALUE thread) { - return rb_thread_ptr(thread)->abort_on_exception ? Qtrue : Qfalse; + return RBOOL(rb_thread_ptr(thread)->abort_on_exception); } @@ -3085,7 +3080,7 @@ rb_thread_abort_exc_set(VALUE thread, VALUE val) static VALUE rb_thread_s_report_exc(VALUE _) { - return GET_THREAD()->vm->thread_report_on_exception ? Qtrue : Qfalse; + return RBOOL(GET_THREAD()->vm->thread_report_on_exception); } @@ -3141,7 +3136,7 @@ rb_thread_s_report_exc_set(VALUE self, VALUE val) static VALUE rb_thread_s_ignore_deadlock(VALUE _) { - return GET_THREAD()->vm->thread_ignore_deadlock ? Qtrue : Qfalse; + return RBOOL(GET_THREAD()->vm->thread_ignore_deadlock); } @@ -3192,7 +3187,7 @@ rb_thread_s_ignore_deadlock_set(VALUE self, VALUE val) static VALUE rb_thread_report_exc(VALUE thread) { - return rb_thread_ptr(thread)->report_on_exception ? Qtrue : Qfalse; + return RBOOL(rb_thread_ptr(thread)->report_on_exception); } @@ -3868,14 +3863,7 @@ rb_thread_variable_p(VALUE thread, VALUE key) } locals = rb_thread_local_storage(thread); - if (rb_hash_lookup(locals, rb_to_symbol(key)) != Qnil) { - return Qtrue; - } - else { - return Qfalse; - } - - return Qfalse; + return RBOOL(rb_hash_lookup(locals, rb_to_symbol(key)) != Qnil); } /* @@ -4933,9 +4921,7 @@ thgroup_enclosed_p(VALUE group) struct thgroup *data; TypedData_Get_Struct(group, struct thgroup, &thgroup_data_type, data); - if (data->enclosed) - return Qtrue; - return Qfalse; + return RBOOL(data->enclosed); } @@ -5095,7 +5081,7 @@ rb_thread_shield_release(VALUE self) { VALUE mutex = thread_shield_get_mutex(self); rb_mutex_unlock(mutex); - return rb_thread_shield_waiting(self) > 0 ? Qtrue : Qfalse; + return RBOOL(rb_thread_shield_waiting(self) > 0); } /* @@ -5107,7 +5093,7 @@ rb_thread_shield_destroy(VALUE self) VALUE mutex = thread_shield_get_mutex(self); DATA_PTR(self) = 0; rb_mutex_unlock(mutex); - return rb_thread_shield_waiting(self) > 0 ? Qtrue : Qfalse; + return RBOOL(rb_thread_shield_waiting(self) > 0); } static VALUE |