Some codes replace to RBOOL
macro (#5023)
* Some code replace and using RBOOL macro * Fix indent * Using RBOOL in syserr_eqq function
This commit is contained in:
parent
c1c13c58ee
commit
75aae66c4f
Notes:
git
2021-11-09 17:09:50 +09:00
Merged-By: nobu <nobu@ruby-lang.org>
4
error.c
4
error.c
@ -2421,9 +2421,7 @@ syserr_eqq(VALUE self, VALUE exc)
|
||||
num = rb_funcallv(exc, id_errno, 0, 0);
|
||||
}
|
||||
e = rb_const_get(self, id_Errno);
|
||||
if (FIXNUM_P(num) ? num == e : rb_equal(num, e))
|
||||
return Qtrue;
|
||||
return Qfalse;
|
||||
return RBOOL(FIXNUM_P(num) ? num == e : rb_equal(num, e));
|
||||
}
|
||||
|
||||
|
||||
|
20
process.c
20
process.c
@ -898,10 +898,7 @@ pst_wifstopped(VALUE st)
|
||||
{
|
||||
int status = PST2INT(st);
|
||||
|
||||
if (WIFSTOPPED(status))
|
||||
return Qtrue;
|
||||
else
|
||||
return Qfalse;
|
||||
return RBOOL(WIFSTOPPED(status));
|
||||
}
|
||||
|
||||
|
||||
@ -937,10 +934,7 @@ pst_wifsignaled(VALUE st)
|
||||
{
|
||||
int status = PST2INT(st);
|
||||
|
||||
if (WIFSIGNALED(status))
|
||||
return Qtrue;
|
||||
else
|
||||
return Qfalse;
|
||||
return RBOOL(WIFSIGNALED(status));
|
||||
}
|
||||
|
||||
|
||||
@ -978,10 +972,7 @@ pst_wifexited(VALUE st)
|
||||
{
|
||||
int status = PST2INT(st);
|
||||
|
||||
if (WIFEXITED(status))
|
||||
return Qtrue;
|
||||
else
|
||||
return Qfalse;
|
||||
return RBOOL(WIFEXITED(status));
|
||||
}
|
||||
|
||||
|
||||
@ -1047,10 +1038,7 @@ pst_wcoredump(VALUE st)
|
||||
#ifdef WCOREDUMP
|
||||
int status = PST2INT(st);
|
||||
|
||||
if (WCOREDUMP(status))
|
||||
return Qtrue;
|
||||
else
|
||||
return Qfalse;
|
||||
return RBOOL(WCOREDUMP(status));
|
||||
#else
|
||||
return Qfalse;
|
||||
#endif
|
||||
|
6
range.c
6
range.c
@ -1792,14 +1792,12 @@ range_include_internal(VALUE range, VALUE val, int string_use_cover)
|
||||
else if (NIL_P(beg)) {
|
||||
VALUE r = rb_funcall(val, id_cmp, 1, end);
|
||||
if (NIL_P(r)) return Qfalse;
|
||||
if (rb_cmpint(r, val, end) <= 0) return Qtrue;
|
||||
return Qfalse;
|
||||
return RBOOL(rb_cmpint(r, val, end) <= 0);
|
||||
}
|
||||
else if (NIL_P(end)) {
|
||||
VALUE r = rb_funcall(beg, id_cmp, 1, val);
|
||||
if (NIL_P(r)) return Qfalse;
|
||||
if (rb_cmpint(r, beg, val) <= 0) return Qtrue;
|
||||
return Qfalse;
|
||||
return RBOOL(rb_cmpint(r, beg, val) <= 0);
|
||||
}
|
||||
}
|
||||
return Qundef;
|
||||
|
Loading…
x
Reference in New Issue
Block a user