summaryrefslogtreecommitdiff
path: root/os2
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-08-19 18:15:09 -0600
committerKarl Williamson <khw@cpan.org>2020-08-19 18:29:55 -0600
commit102356aa7a9d5f0d80a7c170bf35a6768b7f8769 (patch)
treec450d3ece2a9f7253ca4c5c560512f8b7aaad0a7 /os2
parentb38ce61ef5b98631f9924bea9364ec344b9a8d10 (diff)
downloadperl-102356aa7a9d5f0d80a7c170bf35a6768b7f8769.tar.gz
os2.c: Convert to use av_count()
Diffstat (limited to 'os2')
-rw-r--r--os2/os2.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/os2/os2.c b/os2/os2.c
index 68f14ff169..3e2bd1b31b 100644
--- a/os2/os2.c
+++ b/os2/os2.c
@@ -2025,8 +2025,8 @@ mod2fname(pTHX_ SV *sv)
if (SvTYPE(sv) != SVt_PVAV)
Perl_croak_nocontext("Not array reference given to mod2fname");
- avlen = av_tindex((AV*)sv);
- if (avlen < 0)
+ avlen = av_count((AV*)sv);
+ if (avlen == 0)
Perl_croak_nocontext("Empty array reference given to mod2fname");
s = SvPV(*av_fetch((AV*)sv, avlen, FALSE), n_a);
@@ -2037,8 +2037,7 @@ mod2fname(pTHX_ SV *sv)
sum = 33 * sum + *(s++); /* Checksumming first chars to
* get the capitalization into c.s. */
}
- avlen --;
- while (avlen >= 0) {
+ while (avlen > 0) {
s = SvPV(*av_fetch((AV*)sv, avlen, FALSE), n_a);
while (*s) {
sum = 33 * sum + *(s++); /* 7 is primitive mod 13. */