From 1f4f6c9832d83e7ebd65ccf4e95cef358b3512c6 Mon Sep 17 00:00:00 2001 From: S-H-GAMELINKS Date: Tue, 15 Nov 2022 13:24:08 +0900 Subject: Using UNDEF_P macro --- vm_eval.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'vm_eval.c') diff --git a/vm_eval.c b/vm_eval.c index eddc6f80da..c83a88f9fa 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -621,7 +621,7 @@ check_funcall_missing(rb_execution_context_t *ec, VALUE klass, VALUE recv, ID mi ID2SYM(mid), Qtrue); if (!RTEST(ret)) return def; args.respond = respond > 0; - args.respond_to_missing = (ret != Qundef); + args.respond_to_missing = !UNDEF_P(ret); ret = def; cme = callable_method_entry(klass, idMethodMissing, &args.defined_class); @@ -684,7 +684,7 @@ rb_check_funcall_default_kw(VALUE recv, ID mid, int argc, const VALUE *argv, VAL if (!check_funcall_callable(ec, me)) { VALUE ret = check_funcall_missing(ec, klass, recv, mid, argc, argv, respond, def, kw_splat); - if (ret == Qundef) ret = def; + if (UNDEF_P(ret)) ret = def; return ret; } stack_check(ec); @@ -715,7 +715,7 @@ rb_check_funcall_with_hook_kw(VALUE recv, ID mid, int argc, const VALUE *argv, if (!check_funcall_callable(ec, me)) { VALUE ret = check_funcall_missing(ec, klass, recv, mid, argc, argv, respond, Qundef, kw_splat); - (*hook)(ret != Qundef, recv, mid, argc, argv, arg); + (*hook)(!UNDEF_P(ret), recv, mid, argc, argv, arg); return ret; } stack_check(ec); @@ -846,7 +846,7 @@ rb_method_call_status(rb_execution_context_t *ec, const rb_callable_method_entry defined_class = RBASIC(defined_class)->klass; } - if (self == Qundef || !rb_obj_is_kind_of(self, defined_class)) { + if (UNDEF_P(self) || !rb_obj_is_kind_of(self, defined_class)) { return MISSING_PROTECTED; } } @@ -1357,7 +1357,7 @@ rb_yield_1(VALUE val) VALUE rb_yield(VALUE val) { - if (val == Qundef) { + if (UNDEF_P(val)) { return rb_yield_0(0, NULL); } else { @@ -1698,7 +1698,7 @@ eval_make_iseq(VALUE src, VALUE fname, int line, const rb_binding_t *bind, fname = rb_source_location(&line); } - if (fname != Qundef) { + if (!UNDEF_P(fname)) { if (!NIL_P(fname)) fname = rb_fstring(fname); } else { -- cgit v1.2.1