diff options
author | S.H <gamelinks007@gmail.com> | 2021-10-03 22:34:45 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-03 22:34:45 +0900 |
commit | dc9112cf10e63b5272e9469d080d5d1ced30276e (patch) | |
tree | 2970b172b25b303dd839fced592564a77eedeab1 /struct.c | |
parent | fb03598666ddbb9f8b35eb4f599e75654ca7ca06 (diff) |
Using NIL_P macro instead of `== Qnil`
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4925
Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'struct.c')
-rw-r--r-- | struct.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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)."); } |