From 378e8cdad69e6ba995a024da2957719789f0679e Mon Sep 17 00:00:00 2001 From: "S.H" Date: Mon, 2 Aug 2021 12:06:44 +0900 Subject: Using RBOOL macro --- string.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index 0d6b02b1dd..2c0140a02c 100644 --- a/string.c +++ b/string.c @@ -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); } /** -- cgit v1.2.3