From ff30358d13d24d8202f2717c43700be70bdd49d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Fri, 14 Aug 2020 14:45:23 +0900 Subject: RARRAY_AREF: convert into an inline function RARRAY_AREF has been a macro for reasons. We might not be able to change that for public APIs, but why not relax the situation internally to make it an inline function. --- internal/array.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'internal') diff --git a/internal/array.h b/internal/array.h index 2e53d43c7d..c9f2b47145 100644 --- a/internal/array.h +++ b/internal/array.h @@ -100,4 +100,15 @@ RARY_TRANSIENT_UNSET(VALUE ary) }) #endif +#undef RARRAY_AREF +RBIMPL_ATTR_PURE_UNLESS_DEBUG() +RBIMPL_ATTR_ARTIFICIAL() +static inline VALUE +RARRAY_AREF(VALUE ary, long i) +{ + RBIMPL_ASSERT_TYPE(ary, RUBY_T_ARRAY); + + return RARRAY_CONST_PTR_TRANSIENT(ary)[i]; +} + #endif /* INTERNAL_ARRAY_H */ -- cgit v1.2.3