summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authorS.H <gamelinks007@gmail.com>2021-09-15 08:11:05 +0900
committerGitHub <noreply@github.com>2021-09-15 08:11:05 +0900
commitb8c3a84bddac7366c4e391234b2535253869e885 (patch)
tree872dfa2014b75fc4c5dadb060900afa118cded71 /re.c
parent89242279e61b023a81c58065c62a82de8829d0b3 (diff)
downloadruby-b8c3a84bddac7366c4e391234b2535253869e885.tar.gz
Refactor and Using RBOOL macro
Diffstat (limited to 're.c')
-rw-r--r--re.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/re.c b/re.c
index 2afa824cad..5c5b53dddc 100644
--- a/re.c
+++ b/re.c
@@ -1724,8 +1724,7 @@ rb_reg_nth_defined(int nth, VALUE match)
nth += regs->num_regs;
if (nth <= 0) return Qnil;
}
- if (BEG(nth) == -1) return Qfalse;
- return Qtrue;
+ return RBOOL(BEG(nth) != -1);
}
VALUE
@@ -3053,10 +3052,7 @@ rb_reg_equal(VALUE re1, VALUE re2)
if (RREGEXP_PTR(re1)->options != RREGEXP_PTR(re2)->options) return Qfalse;
if (RREGEXP_SRC_LEN(re1) != RREGEXP_SRC_LEN(re2)) return Qfalse;
if (ENCODING_GET(re1) != ENCODING_GET(re2)) return Qfalse;
- if (memcmp(RREGEXP_SRC_PTR(re1), RREGEXP_SRC_PTR(re2), RREGEXP_SRC_LEN(re1)) == 0) {
- return Qtrue;
- }
- return Qfalse;
+ return RBOOL(memcmp(RREGEXP_SRC_PTR(re1), RREGEXP_SRC_PTR(re2), RREGEXP_SRC_LEN(re1)) == 0);
}
/*