The Perl equivalent for this is C<$#myarray>.
+(A slightly shorter form is C<av_tindex>.)
+
=for apidoc av_len
Same as L</av_top_index>. Returns the highest index in the array. Note that the
=for apidoc Am|int|AvFILL|AV* av
Same as C<av_top_index()>. Deprecated, use C<av_top_index()> instead.
+=for apidoc Am|int|av_tindex|AV* av
+Same as C<av_top_index()>.
+
=cut
*/
#define AvFILL(av) ((SvRMAGICAL((const SV *) (av))) \
? mg_size(MUTABLE_SV(av)) : AvFILLp(av))
+#define av_tindex(av) av_top_index(av)
#define NEGATIVE_INDICES_VAR "NEGATIVE_INDICES"
ApdR |SV* |av_shift |NN AV *av
Apd |SV** |av_store |NN AV *av|I32 key|NULLOK SV *val
AidR |I32 |av_top_index |NN AV *av
+AmpdR |I32 |av_tindex |NN AV *av
Apd |void |av_undef |NN AV *av
ApdoxM |SV** |av_create_and_unshift_one|NN AV **const avp|NN SV *const val
Apd |void |av_unshift |NN AV *av|I32 num
=item *
+Synonyms for the misleadingly named C<av_len()> has been created:
+C<av_top_index()> and C<av_tindex>. All three of these return the
+number of the highest index in the array, not the number of elements it
+contains. (The name C<av_top> which was introduced in Perl v.5.17.8 has
+been removed.)
+
XXX
=back
#define PERL_ARGS_ASSERT_AV_STORE \
assert(av)
+/* PERL_CALLCONV I32 Perl_av_tindex(pTHX_ AV *av)
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1); */
+
PERL_STATIC_INLINE I32 S_av_top_index(pTHX_ AV *av)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
stack = newAV();
while (RExC_parse < RExC_end) {
- I32 top_index = av_top_index(stack);
+ I32 top_index = av_tindex(stack);
SV** top_ptr;
SV* current = NULL;
switch (curchar) {
case '?':
- if (av_top_index(stack) >= 0 /* This makes sure that we can
+ if (av_tindex(stack) >= 0 /* This makes sure that we can
safely subtract 1 from
RExC_parse in the next clause.
If we have something on the
RExC_parse += (UTF) ? UTF8SKIP(RExC_parse) : 1;
}
- if (av_top_index(stack) < 0 /* Was empty */
+ if (av_tindex(stack) < 0 /* Was empty */
|| ((final = av_pop(stack)) == NULL)
|| ! IS_OPERAND(final)
- || av_top_index(stack) >= 0) /* More left on stack */
+ || av_tindex(stack) >= 0) /* More left on stack */
{
vFAIL("Incomplete expression within '(?[ ])'");
}