summaryrefslogtreecommitdiff
path: root/array.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 /array.c
parentfb03598666ddbb9f8b35eb4f599e75654ca7ca06 (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 'array.c')
-rw-r--r--array.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/array.c b/array.c
index 63d63aa17f..3e949cfa79 100644
--- a/array.c
+++ b/array.c
@@ -3466,7 +3466,7 @@ rb_ary_bsearch_index(VALUE ary)
satisfied = 1;
smaller = 1;
}
- else if (v == Qfalse || v == Qnil) {
+ else if (!RTEST(v)) {
smaller = 0;
}
else if (rb_obj_is_kind_of(v, rb_cNumeric)) {
@@ -6479,7 +6479,7 @@ rb_ary_cycle_size(VALUE self, VALUE args, VALUE eobj)
n = RARRAY_AREF(args, 0);
}
if (RARRAY_LEN(self) == 0) return INT2FIX(0);
- if (n == Qnil) return DBL2NUM(HUGE_VAL);
+ if (NIL_P(n)) return DBL2NUM(HUGE_VAL);
mul = NUM2LONG(n);
if (mul <= 0) return INT2FIX(0);
n = LONG2FIX(mul);
@@ -7344,7 +7344,7 @@ rb_ary_drop(VALUE ary, VALUE n)
}
result = rb_ary_subseq(ary, pos, RARRAY_LEN(ary));
- if (result == Qnil) result = rb_ary_new();
+ if (NIL_P(result)) result = rb_ary_new();
return result;
}