Reuse NIL_OR_UNDEF_P macro

This commit is contained in:
S-H-GAMELINKS 2022-11-22 21:49:54 +09:00 committed by Nobuyoshi Nakada
parent 2c939458ca
commit 040e0c8d67
Notes: git 2022-12-01 16:20:22 +00:00
4 changed files with 4 additions and 4 deletions

View file

@ -50,7 +50,7 @@ VALUE
rb_invcmp(VALUE x, VALUE y) rb_invcmp(VALUE x, VALUE y)
{ {
VALUE invcmp = rb_exec_recursive(invcmp_recursive, x, y); VALUE invcmp = rb_exec_recursive(invcmp_recursive, x, y);
if (UNDEF_P(invcmp) || NIL_P(invcmp)) { if (NIL_OR_UNDEF_P(invcmp)) {
return Qnil; return Qnil;
} }
else { else {

2
dir.c
View file

@ -2932,7 +2932,7 @@ dir_globs(VALUE args, VALUE base, int flags)
static VALUE static VALUE
dir_glob_option_base(VALUE base) dir_glob_option_base(VALUE base)
{ {
if (UNDEF_P(base) || NIL_P(base)) { if (NIL_OR_UNDEF_P(base)) {
return Qnil; return Qnil;
} }
#if USE_OPENDIR_AT #if USE_OPENDIR_AT

View file

@ -2084,7 +2084,7 @@ name_err_mesg_to_str(VALUE obj)
break; break;
default: default:
d = rb_protect(name_err_mesg_receiver_name, obj, &state); d = rb_protect(name_err_mesg_receiver_name, obj, &state);
if (state || UNDEF_P(d) || NIL_P(d)) if (state || NIL_OR_UNDEF_P(d))
d = rb_protect(rb_inspect, obj, &state); d = rb_protect(rb_inspect, obj, &state);
if (state) { if (state) {
rb_set_errinfo(Qnil); rb_set_errinfo(Qnil);

2
io.c
View file

@ -1424,7 +1424,7 @@ rb_io_wait(VALUE io, VALUE events, VALUE timeout)
struct timeval tv_storage; struct timeval tv_storage;
struct timeval *tv = NULL; struct timeval *tv = NULL;
if (timeout == Qnil || UNDEF_P(timeout)) { if (NIL_OR_UNDEF_P(timeout)) {
timeout = fptr->timeout; timeout = fptr->timeout;
} }