diff options
author | S.H <[email protected]> | 2021-08-02 12:06:44 +0900 |
---|---|---|
committer | GitHub <[email protected]> | 2021-08-02 12:06:44 +0900 |
commit | 378e8cdad69e6ba995a024da2957719789f0679e (patch) | |
tree | 99ffe0f8055bc10cba3225fb5e7a906f5c3f4543 /string.c | |
parent | 3688b476710def7290e32656b200fefc538366d0 (diff) |
Using RBOOL macro
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4695
Merged-By: nobu <[email protected]>
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -2015,9 +2015,7 @@ rb_str_bytesize(VALUE str) static VALUE rb_str_empty(VALUE str) { - if (RSTRING_LEN(str) == 0) - return Qtrue; - return Qfalse; + return RBOOL(RSTRING_LEN(str) == 0); } /* @@ -4629,7 +4627,7 @@ rb_str_include_range_p(VALUE beg, VALUE end, VALUE val, VALUE exclusive) } rb_str_upto_each(beg, end, RTEST(exclusive), include_range_i, (VALUE)&val); - return NIL_P(val) ? Qtrue : Qfalse; + return RBOOL(NIL_P(val)); } static VALUE @@ -5962,8 +5960,7 @@ rb_str_include(VALUE str, VALUE arg) StringValue(arg); i = rb_str_index(str, arg, 0); - if (i == -1) return Qfalse; - return Qtrue; + return RBOOL(i != -1); } @@ -10470,7 +10467,7 @@ rb_str_valid_encoding_p(VALUE str) { int cr = rb_enc_str_coderange(str); - return cr == ENC_CODERANGE_BROKEN ? Qfalse : Qtrue; + return RBOOL(cr != ENC_CODERANGE_BROKEN); } /* @@ -10488,7 +10485,7 @@ rb_str_is_ascii_only_p(VALUE str) { int cr = rb_enc_str_coderange(str); - return cr == ENC_CODERANGE_7BIT ? Qtrue : Qfalse; + return RBOOL(cr == ENC_CODERANGE_7BIT); } /** |