This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl_sv_vcatpvfn_flags: get rid of an (int) cast
authorDavid Mitchell <davem@iabyn.com>
Wed, 10 May 2017 16:23:51 +0000 (17:23 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 7 Jun 2017 08:11:00 +0000 (09:11 +0100)
harmless in this case, but there really shouldn't be (int) casts
on string length and ptr diff calculations

sv.c

diff --git a/sv.c b/sv.c
index 07fa7fe..5773234 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -11531,7 +11531,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
        /* XXX: Why do this `svix < svmax` test? Couldn't we just
           format the first argument and WARN_REDUNDANT if svmax > 1?
           Munged by Nicholas Clark in v5.13.0-209-g95ea86d */
-       if (pp - pat == (int)patlen - 1 && svix < svmax) {
+       if (pp + 1 == pat + patlen && svix < svmax) {
            const NV nv = SvNV(*svargs);
             if (LIKELY(!Perl_isinfnan(nv))) {
                 if (*pp == 'g') {