diff options
author | S.H <gamelinks007@gmail.com> | 2021-09-15 08:11:05 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-15 08:11:05 +0900 |
commit | b8c3a84bddac7366c4e391234b2535253869e885 (patch) | |
tree | 872dfa2014b75fc4c5dadb060900afa118cded71 /variable.c | |
parent | 89242279e61b023a81c58065c62a82de8829d0b3 (diff) |
Refactor and Using RBOOL macro
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4837
Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/variable.c b/variable.c index 0e442241ea..aa1fdd022e 100644 --- a/variable.c +++ b/variable.c @@ -783,8 +783,7 @@ MJIT_FUNC_EXPORTED VALUE rb_gvar_defined(ID id) { struct rb_global_entry *entry = rb_global_entry(id); - if (entry->var->getter == rb_gvar_undef_getter) return Qfalse; - return Qtrue; + return RBOOL(entry->var->getter != rb_gvar_undef_getter); } rb_gvar_getter_t * @@ -1099,10 +1098,7 @@ generic_ivar_defined(VALUE obj, ID id) if (!iv_index_tbl_lookup(iv_index_tbl, id, &index)) return Qfalse; if (!gen_ivtbl_get(obj, id, &ivtbl)) return Qfalse; - if ((index < ivtbl->numiv) && (ivtbl->ivptr[index] != Qundef)) - return Qtrue; - - return Qfalse; + return RBOOL((index < ivtbl->numiv) && (ivtbl->ivptr[index] != Qundef)); } static int |