diff options
author | Karl Williamson <khw@cpan.org> | 2020-08-19 19:06:01 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-08-19 19:11:45 -0600 |
commit | 8272d5bdfa99b9fd92be2d34da4d04eec4c6ddab (patch) | |
tree | a4ec9589fd9da1702b3c237aadd03a0b84cfede9 | |
parent | a35255b755271d430494f12ae140641aeb8a1777 (diff) | |
download | perl-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.c | 2 | ||||
-rw-r--r-- | op.h | 2 | ||||
-rw-r--r-- | pp.c | 4 | ||||
-rw-r--r-- | pp_hot.c | 4 | ||||
-rw-r--r-- | regexec.c | 2 | ||||
-rw-r--r-- | universal.c | 2 |
6 files changed, 8 insertions, 8 deletions
@@ -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 @@ -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; \ \ @@ -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) { @@ -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) @@ -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) { |