summaryrefslogtreecommitdiff
path: root/enumerator.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-09-27 14:47:52 +0900
committerGitHub <noreply@github.com>2021-09-27 14:47:52 +0900
commitf7ffe9dbdeb2bebb4c9155fc391f0bab198bfb51 (patch)
tree24e273a2d906f2c40279f80eef46cbc6a36133fa /enumerator.c
parent582602d142c7ea2b21cd7539c09976b078d7bbe9 (diff)
downloadruby-f7ffe9dbdeb2bebb4c9155fc391f0bab198bfb51.tar.gz
Introduce `RBIMPL_NONNULL_ARG` macro
Runtime assertion for the argument declared as non-null. This macro does nothing if `RBIMPL_ATTR_NONNULL` is effective, otherwise asserts that the argument is non-null.
Diffstat (limited to 'enumerator.c')
-rw-r--r--enumerator.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/enumerator.c b/enumerator.c
index f359ab7bad..be469ee38b 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -3446,11 +3446,9 @@ rb_arithmetic_sequence_extract(VALUE obj, rb_arithmetic_sequence_components_t *c
VALUE
rb_arithmetic_sequence_beg_len_step(VALUE obj, long *begp, long *lenp, long *stepp, long len, int err)
{
-#if !RBIMPL_HAS_ATTRIBUTE(nonnull)
- RUBY_ASSERT(begp != NULL);
- RUBY_ASSERT(lenp != NULL);
- RUBY_ASSERT(stepp != NULL);
-#endif
+ RBIMPL_NONNULL_ARG(begp);
+ RBIMPL_NONNULL_ARG(lenp);
+ RBIMPL_NONNULL_ARG(stepp);
rb_arithmetic_sequence_components_t aseq;
if (!rb_arithmetic_sequence_extract(obj, &aseq)) {