From 1f4f6c9832d83e7ebd65ccf4e95cef358b3512c6 Mon Sep 17 00:00:00 2001 From: S-H-GAMELINKS Date: Tue, 15 Nov 2022 13:24:08 +0900 Subject: Using UNDEF_P macro --- string.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'string.c') 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)) { -- cgit v1.2.1