summaryrefslogtreecommitdiff
path: root/string.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 /string.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 'string.c')
-rw-r--r--string.c13
1 files changed, 5 insertions, 8 deletions
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);
}
/**