mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Using NIL_P macro instead of == Qnil
This commit is contained in:
parent
fb03598666
commit
dc9112cf10
Notes:
git
2021-10-03 22:35:06 +09:00
Merged: https://github.com/ruby/ruby/pull/4925 Merged-By: nobu <nobu@ruby-lang.org>
18 changed files with 43 additions and 43 deletions
4
enum.c
4
enum.c
|
@ -2921,7 +2921,7 @@ enum_each_slice_size(VALUE obj, VALUE args, VALUE eobj)
|
|||
if (slice_size <= 0) rb_raise(rb_eArgError, "invalid slice size");
|
||||
|
||||
size = enum_size(obj, 0, 0);
|
||||
if (size == Qnil) return Qnil;
|
||||
if (NIL_P(size)) return Qnil;
|
||||
if (RB_FLOAT_TYPE_P(size) && RTEST(rb_funcall(size, infinite_p, 0))) {
|
||||
return size;
|
||||
}
|
||||
|
@ -3003,7 +3003,7 @@ enum_each_cons_size(VALUE obj, VALUE args, VALUE eobj)
|
|||
if (cons_size <= 0) rb_raise(rb_eArgError, "invalid size");
|
||||
|
||||
size = enum_size(obj, 0, 0);
|
||||
if (size == Qnil) return Qnil;
|
||||
if (NIL_P(size)) return Qnil;
|
||||
|
||||
n = add_int(size, 1 - cons_size);
|
||||
return (OPTIMIZED_CMP(n, zero, cmp_opt) == -1) ? zero : n;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue