summaryrefslogtreecommitdiff
path: root/sprintf.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 /sprintf.c
parentdc1c4e46758ace2c9e5e822df0d64b16bb564bb4 (diff)
Using UNDEF_P macro
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6721
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sprintf.c b/sprintf.c
index bfe25e1d3c..b26dffec85 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -97,7 +97,7 @@ sign_bits(int base, const char *p)
blen += (l);\
} while (0)
-#define GETARG() (nextvalue != Qundef ? nextvalue : \
+#define GETARG() (!UNDEF_P(nextvalue) ? nextvalue : \
GETNEXTARG())
#define GETNEXTARG() ( \
@@ -193,7 +193,7 @@ get_hash(volatile VALUE *hash, int argc, const VALUE *argv)
{
VALUE tmp;
- if (*hash != Qundef) return *hash;
+ if (!UNDEF_P(*hash)) return *hash;
if (argc != 2) {
rb_raise(rb_eArgError, "one hash required");
}
@@ -336,7 +336,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
n = 0;
GETNUM(n, width);
if (*p == '$') {
- if (nextvalue != Qundef) {
+ if (!UNDEF_P(nextvalue)) {
rb_raise(rb_eArgError, "value given twice - %d$", n);
}
nextvalue = GETPOSARG(n);
@@ -381,7 +381,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
len - 2 /* without parenthesis */,
enc);
if (!NIL_P(sym)) nextvalue = rb_hash_lookup2(hash, sym, Qundef);
- if (nextvalue == Qundef) {
+ if (UNDEF_P(nextvalue)) {
if (NIL_P(sym)) {
sym = rb_sym_intern(start + 1,
len - 2 /* without parenthesis */,