b2938d
From bd5fa06648085e8c17efd55abeb6424aeeb1018e Mon Sep 17 00:00:00 2001
b2938d
From: Karl Williamson <khw@cpan.org>
b2938d
Date: Tue, 29 Sep 2020 00:48:19 -0600
b2938d
Subject: [PATCH] Remove Perl_av_top_index
b2938d
MIME-Version: 1.0
b2938d
Content-Type: text/plain; charset=UTF-8
b2938d
Content-Transfer-Encoding: 8bit
b2938d
b2938d
I created this in 87306e0674dfe3af29804b4641347cd5ac9b0521, thinking it
b2938d
was needed to preserve backward compatibility if someone were using this
b2938d
instead of the macro.  But it turned out that there never was such a
b2938d
function, it was inlined, and the name was S_av_top_index, so there is
b2938d
no reason to create a new function that no one has ever been able to
b2938d
call.  So just remove it, and let all accesses go through the macro
b2938d
b2938d
Signed-off-by: Petr Písař <ppisar@redhat.com>
b2938d
---
b2938d
 av.c      | 10 ----------
b2938d
 embed.fnc |  2 +-
b2938d
 proto.h   |  7 +++----
b2938d
 3 files changed, 4 insertions(+), 15 deletions(-)
b2938d
b2938d
diff --git a/av.c b/av.c
b2938d
index ada09cde9a..ad2429f90d 100644
b2938d
--- a/av.c
b2938d
+++ b/av.c
b2938d
@@ -1095,16 +1095,6 @@ Perl_av_nonelem(pTHX_ AV *av, SSize_t ix) {
b2938d
     return sv;
b2938d
 }
b2938d
 
b2938d
-SSize_t
b2938d
-Perl_av_top_index(pTHX_ AV *av)
b2938d
-{
b2938d
-    PERL_ARGS_ASSERT_AV_TOP_INDEX;
b2938d
-    assert(SvTYPE(av) == SVt_PVAV);
b2938d
-
b2938d
-    return AvFILL(av);
b2938d
-}
b2938d
-
b2938d
-
b2938d
 /*
b2938d
  * ex: set ts=8 sts=4 sw=4 et:
b2938d
  */
b2938d
diff --git a/embed.fnc b/embed.fnc
b2938d
index a6b4d0350f..f5c5b29c2d 100644
b2938d
--- a/embed.fnc
b2938d
+++ b/embed.fnc
b2938d
@@ -637,7 +637,7 @@ Apd	|void	|av_push	|NN AV *av|NN SV *val
b2938d
 EXp	|void	|av_reify	|NN AV *av
b2938d
 ApdR	|SV*	|av_shift	|NN AV *av
b2938d
 Apd	|SV**	|av_store	|NN AV *av|SSize_t key|NULLOK SV *val
b2938d
-AMdRp	|SSize_t|av_top_index	|NN AV *av
b2938d
+AmdR	|SSize_t|av_top_index	|NN AV *av
b2938d
 AidRp	|Size_t	|av_count	|NN AV *av
b2938d
 AmdR	|SSize_t|av_tindex	|NN AV *av
b2938d
 Apd	|void	|av_undef	|NN AV *av
b2938d
diff --git a/proto.h b/proto.h
b2938d
index c4490fc46e..2da1a07761 100644
b2938d
--- a/proto.h
b2938d
+++ b/proto.h
b2938d
@@ -291,10 +291,9 @@ PERL_CALLCONV SV**	Perl_av_store(pTHX_ AV *av, SSize_t key, SV *val);
b2938d
 			__attribute__warn_unused_result__; */
b2938d
 #define PERL_ARGS_ASSERT_AV_TINDEX
b2938d
 
b2938d
-PERL_CALLCONV SSize_t	Perl_av_top_index(pTHX_ AV *av)
b2938d
-			__attribute__warn_unused_result__;
b2938d
-#define PERL_ARGS_ASSERT_AV_TOP_INDEX	\
b2938d
-	assert(av)
b2938d
+/* PERL_CALLCONV SSize_t	av_top_index(pTHX_ AV *av)
b2938d
+			__attribute__warn_unused_result__; */
b2938d
+#define PERL_ARGS_ASSERT_AV_TOP_INDEX
b2938d
 
b2938d
 PERL_CALLCONV void	Perl_av_undef(pTHX_ AV *av);
b2938d
 #define PERL_ARGS_ASSERT_AV_UNDEF	\
b2938d
-- 
b2938d
2.25.4
b2938d