diff options
author | Karl Williamson <khw@cpan.org> | 2020-08-19 18:15:09 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-08-19 18:29:55 -0600 |
commit | 102356aa7a9d5f0d80a7c170bf35a6768b7f8769 (patch) | |
tree | c450d3ece2a9f7253ca4c5c560512f8b7aaad0a7 | |
parent | b38ce61ef5b98631f9924bea9364ec344b9a8d10 (diff) | |
download | perl-102356aa7a9d5f0d80a7c170bf35a6768b7f8769.tar.gz |
os2.c: Convert to use av_count()
-rw-r--r-- | os2/os2.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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. */ |