summaryrefslogtreecommitdiff
path: root/av.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-08-19 11:57:17 -0600
committerKarl Williamson <khw@cpan.org>2020-08-19 16:12:19 -0600
commit87306e0674dfe3af29804b4641347cd5ac9b0521 (patch)
tree8693933fae0918d3570f6d4d412ac8d91eea5160 /av.h
parent62066149de47fdbff345b71823d783ffad25933f (diff)
downloadperl-87306e0674dfe3af29804b4641347cd5ac9b0521.tar.gz
Add av_count()
This returns the number of elements in an array in a clearly named function. av_top_index(), av_tindex() are clearly named, but are less than ideal, and came about because no one back then thought of this one, until now Paul Evans did.
Diffstat (limited to 'av.h')
-rw-r--r--av.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/av.h b/av.h
index 5e39c42ea1..90ebfff7af 100644
--- a/av.h
+++ b/av.h
@@ -81,7 +81,8 @@ Same as C<av_top_index()>.
#define AvFILL(av) ((SvRMAGICAL((const SV *) (av))) \
? mg_size(MUTABLE_SV(av)) : AvFILLp(av))
-#define av_tindex(av) av_top_index(av)
+#define av_top_index(av) AvFILL(av)
+#define av_tindex(av) av_top_index(av)
/* Note that it doesn't make sense to do this:
* SvGETMAGIC(av); IV x = av_tindex_nomg(av);