summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorS-H-GAMELINKS <gamelinks007@gmail.com>2022-11-15 13:24:08 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-11-16 18:58:33 +0900
commit1f4f6c9832d83e7ebd65ccf4e95cef358b3512c6 (patch)
tree823f1ca5409fdd930b05d974cdb70953b6e7e128 /string.c
parentdc1c4e46758ace2c9e5e822df0d64b16bb564bb4 (diff)
downloadruby-1f4f6c9832d83e7ebd65ccf4e95cef358b3512c6.tar.gz
Using UNDEF_P macro
Diffstat (limited to 'string.c')
-rw-r--r--string.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/string.c b/string.c
index 50da6dc621..0ae36e5c72 100644
--- a/string.c
+++ b/string.c
@@ -495,7 +495,7 @@ register_fstring(VALUE str, bool copy)
do {
args.fstr = str;
st_update(frozen_strings, (st_data_t)str, fstr_update_callback, (st_data_t)&args);
- } while (args.fstr == Qundef);
+ } while (UNDEF_P(args.fstr));
}
RB_VM_LOCK_LEAVE();
@@ -1873,10 +1873,10 @@ rb_str_init(int argc, VALUE *argv, VALUE str)
rb_get_kwargs(opt, keyword_ids, 0, 2, kwargs);
venc = kwargs[0];
vcapa = kwargs[1];
- if (venc != Qundef && !NIL_P(venc)) {
+ if (!UNDEF_P(venc) && !NIL_P(venc)) {
enc = rb_to_encoding(venc);
}
- if (vcapa != Qundef && !NIL_P(vcapa)) {
+ if (!UNDEF_P(vcapa) && !NIL_P(vcapa)) {
long capa = NUM2LONG(vcapa);
long len = 0;
int termlen = enc ? rb_enc_mbminlen(enc) : 1;
@@ -8922,7 +8922,7 @@ rb_str_enumerate_lines(int argc, VALUE *argv, VALUE str, VALUE ary)
keywords[0] = rb_intern_const("chomp");
}
rb_get_kwargs(opts, keywords, 0, 1, &chomp);
- chomp = (chomp != Qundef && RTEST(chomp));
+ chomp = (!UNDEF_P(chomp) && RTEST(chomp));
}
if (NIL_P(rs)) {