summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-08-19 19:06:01 -0600
committerKarl Williamson <khw@cpan.org>2020-08-19 19:11:45 -0600
commit8272d5bdfa99b9fd92be2d34da4d04eec4c6ddab (patch)
treea4ec9589fd9da1702b3c237aadd03a0b84cfede9
parenta35255b755271d430494f12ae140641aeb8a1777 (diff)
downloadperl-8272d5bdfa99b9fd92be2d34da4d04eec4c6ddab.tar.gz
Use av_top_index() instead of av_tindex()
I was never happy with this short form, and other people weren't either. Now that most things are better expressed in terms of av_count, convert the few remaining items that are clearer when referring to an index into using the fully spelled out form
-rw-r--r--op.c2
-rw-r--r--op.h2
-rw-r--r--pp.c4
-rw-r--r--pp_hot.c4
-rw-r--r--regexec.c2
-rw-r--r--universal.c2
6 files changed, 8 insertions, 8 deletions
diff --git a/op.c b/op.c
index 49aac853d4..38a55f9c44 100644
--- a/op.c
+++ b/op.c
@@ -8143,7 +8143,7 @@ Perl_newPMOP(pTHX_ I32 type, I32 flags)
} else {
SV * const repointer = &PL_sv_undef;
av_push(PL_regex_padav, repointer);
- pmop->op_pmoffset = av_tindex(PL_regex_padav);
+ pmop->op_pmoffset = av_top_index(PL_regex_padav);
PL_regex_pad = AvARRAY(PL_regex_padav);
}
#endif
diff --git a/op.h b/op.h
index 3264aeb76c..d660c84cdf 100644
--- a/op.h
+++ b/op.h
@@ -816,7 +816,7 @@ preprocessing token; the type of C<arg> depends on C<which>.
STMT_START { \
if (PL_blockhooks) { \
SSize_t i; \
- for (i = av_tindex(PL_blockhooks); i >= 0; i--) { \
+ for (i = av_top_index(PL_blockhooks); i >= 0; i--) { \
SV *sv = AvARRAY(PL_blockhooks)[i]; \
BHK *hk; \
\
diff --git a/pp.c b/pp.c
index 1c387d5450..f836b1685f 100644
--- a/pp.c
+++ b/pp.c
@@ -4988,7 +4988,7 @@ PP(pp_aeach)
IV *iterp = Perl_av_iter_p(aTHX_ array);
const IV current = (*iterp)++;
- if (current > av_tindex(array)) {
+ if (current > av_top_index(array)) {
*iterp = 0;
if (gimme == G_SCALAR)
RETPUSHUNDEF;
@@ -5859,7 +5859,7 @@ PP(pp_reverse)
const MAGIC *mg;
bool can_preserve = SvCANEXISTDELETE(av);
- for (i = 0, j = av_tindex(av); i < j; ++i, --j) {
+ for (i = 0, j = av_top_index(av); i < j; ++i, --j) {
SV *begin, *end;
if (can_preserve) {
diff --git a/pp_hot.c b/pp_hot.c
index 5e4a42314a..7faa1a9c08 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -3640,7 +3640,7 @@ PP(pp_multideref)
IV len;
if (!defer)
DIE(aTHX_ PL_no_aelem, elem);
- len = av_tindex(av);
+ len = av_top_index(av);
/* Resolve a negative index that falls within
* the array. Leave it negative it if falls
* outside the array. */
@@ -5392,7 +5392,7 @@ PP(pp_aelem)
IV len;
if (!defer)
DIE(aTHX_ PL_no_aelem, elem);
- len = av_tindex(av);
+ len = av_top_index(av);
/* Resolve a negative index that falls within the array. Leave
it negative it if falls outside the array. */
if (elem < 0 && len + elem >= 0)
diff --git a/regexec.c b/regexec.c
index 29f455ead0..e763c0a6ab 100644
--- a/regexec.c
+++ b/regexec.c
@@ -10476,7 +10476,7 @@ S_setup_eval_state(pTHX_ regmatch_info *const reginfo)
/* this regexp is also owned by the new PL_reg_curpm, which
will try to free it. */
av_push(PL_regex_padav, repointer);
- PL_reg_curpm->op_pmoffset = av_tindex(PL_regex_padav);
+ PL_reg_curpm->op_pmoffset = av_top_index(PL_regex_padav);
PL_regex_pad = AvARRAY(PL_regex_padav);
}
#endif
diff --git a/universal.c b/universal.c
index 9b032bdfaf..6797b9fb53 100644
--- a/universal.c
+++ b/universal.c
@@ -789,7 +789,7 @@ XS(XS_PerlIO_get_layers)
AV* const av = PerlIO_get_layers(aTHX_ input ?
IoIFP(io) : IoOFP(io));
SSize_t i;
- const SSize_t last = av_tindex(av);
+ const SSize_t last = av_top_index(av);
SSize_t nitem = 0;
for (i = last; i >= 0; i -= 3) {