1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.
This commit is contained in:
卜部昌平 2020-08-14 14:45:23 +09:00
parent 72d0f2f0e0
commit ff30358d13
Notes: git 2020-08-15 12:09:51 +09:00
12 changed files with 34 additions and 17 deletions

View file

@ -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 */