summaryrefslogtreecommitdiff
path: root/range.c
diff options
context:
space:
mode:
authorS.H <gamelinks007@gmail.com>2021-08-02 12:06:44 +0900
committerGitHub <noreply@github.com>2021-08-02 12:06:44 +0900
commit378e8cdad69e6ba995a024da2957719789f0679e (patch)
tree99ffe0f8055bc10cba3225fb5e7a906f5c3f4543 /range.c
parent3688b476710def7290e32656b200fefc538366d0 (diff)
Using RBOOL macro
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4695 Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'range.c')
-rw-r--r--range.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/range.c b/range.c
index 7a297b1ed94..7d08a49eee7 100644
--- a/range.c
+++ b/range.c
@@ -40,7 +40,6 @@ static VALUE r_cover_p(VALUE, VALUE, VALUE, VALUE);
#define RANGE_SET_BEG(r, v) (RSTRUCT_SET(r, 0, v))
#define RANGE_SET_END(r, v) (RSTRUCT_SET(r, 1, v))
#define RANGE_SET_EXCL(r, v) (RSTRUCT_SET(r, 2, v))
-#define RBOOL(v) ((v) ? Qtrue : Qfalse)
#define EXCL(r) RTEST(RANGE_EXCL(r))
@@ -125,7 +124,7 @@ range_initialize_copy(VALUE range, VALUE orig)
static VALUE
range_exclude_end_p(VALUE range)
{
- return EXCL(range) ? Qtrue : Qfalse;
+ return RBOOL(EXCL(range));
}
static VALUE
@@ -137,9 +136,7 @@ recursive_equal(VALUE range, VALUE obj, int recur)
if (!rb_equal(RANGE_END(range), RANGE_END(obj)))
return Qfalse;
- if (EXCL(range) != EXCL(obj))
- return Qfalse;
- return Qtrue;
+ return RBOOL(EXCL(range) == EXCL(obj));
}
@@ -192,9 +189,7 @@ recursive_eql(VALUE range, VALUE obj, int recur)
if (!rb_eql(RANGE_END(range), RANGE_END(obj)))
return Qfalse;
- if (EXCL(range) != EXCL(obj))
- return Qfalse;
- return Qtrue;
+ return RBOOL(EXCL(range) == EXCL(obj));
}
/*