diff options
author | S.H <gamelinks007@gmail.com> | 2021-09-15 08:11:05 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-15 08:11:05 +0900 |
commit | b8c3a84bddac7366c4e391234b2535253869e885 (patch) | |
tree | 872dfa2014b75fc4c5dadb060900afa118cded71 /re.c | |
parent | 89242279e61b023a81c58065c62a82de8829d0b3 (diff) |
Refactor and Using RBOOL macro
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4837
Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -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); } /* |