summaryrefslogtreecommitdiff
path: root/struct.c
diff options
context:
space:
mode:
authorS.H <gamelinks007@gmail.com>2021-10-03 22:34:45 +0900
committerGitHub <noreply@github.com>2021-10-03 22:34:45 +0900
commitdc9112cf10e63b5272e9469d080d5d1ced30276e (patch)
tree2970b172b25b303dd839fced592564a77eedeab1 /struct.c
parentfb03598666ddbb9f8b35eb4f599e75654ca7ca06 (diff)
downloadruby-dc9112cf10e63b5272e9469d080d5d1ced30276e.tar.gz
Using NIL_P macro instead of `== Qnil`
Diffstat (limited to 'struct.c')
-rw-r--r--struct.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/struct.c b/struct.c
index 5aa70edf24..6fc5bf1048 100644
--- a/struct.c
+++ b/struct.c
@@ -712,7 +712,7 @@ struct_hash_set_i(VALUE key, VALUE val, VALUE arg)
struct struct_hash_set_arg *args = (struct struct_hash_set_arg *)arg;
int i = rb_struct_pos(args->self, &key);
if (i < 0) {
- if (args->unknown_keywords == Qnil) {
+ if (NIL_P(args->unknown_keywords)) {
args->unknown_keywords = rb_ary_new();
}
rb_ary_push(args->unknown_keywords, key);
@@ -754,7 +754,7 @@ rb_struct_initialize_m(int argc, const VALUE *argv, VALUE self)
if (n < argc) {
rb_raise(rb_eArgError, "struct size differs");
}
- if (keyword_init == Qnil && argc == 1 && RB_TYPE_P(argv[0], T_HASH) && rb_keyword_given_p()) {
+ if (NIL_P(keyword_init) && argc == 1 && RB_TYPE_P(argv[0], T_HASH) && rb_keyword_given_p()) {
rb_warn("Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3.2. "\
"Please use a Hash literal like .new({k: v}) instead of .new(k: v).");
}