In perl.git, the branch maint-5.20 has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/8cce5ff50d4f798ff6b439104a20c63a62e06b04?hp=c49405fd21fbf9c1f3f4b2718c3d556492462386>

- Log -----------------------------------------------------------------
commit 8cce5ff50d4f798ff6b439104a20c63a62e06b04
Author: Steve Hay <[email protected]>
Date:   Tue Jul 22 09:29:48 2014 +0100

    Get t/porting/cmp_version.t passing again following 3429841
    
    (Can't bump $VERSION to 0.61 or 0.62 since they're already out in 5.21.1
    and 5.21.2 with different/more changes than 3429841 in them.)

M       ext/XS-APItest/APItest.pm

commit 35c10440fa8484385091cd3cf143508cd70ee9d6
Author: Tony Cook <[email protected]>
Date:   Tue May 20 15:06:16 2014 +1000

    bump $PerlIO::via::VERSION to 0.15
    
    (cherry picked from commit fe2ce09d592612ace5bf8acccba9db512adb54a5)

M       ext/PerlIO-via/via.pm

commit 34298414de23eaacc8fc7aed8ecf9ea0d78b1acc
Author: Jarkko Hietaniemi <[email protected]>
Date:   Tue Jun 24 18:57:19 2014 -0400

    Under GLOBAL_STRUCT mgvtbl-s are const, which angers g++.
    
    See also 31114fe99.
    
    (cherry picked from commit 55cdf547048d9ab6990ce2049934612b3be307a4)

M       ext/XS-APItest/APItest.xs

commit 2f7d81385d2fd64ea3b255daf837995d70790c33
Author: Tony Cook <[email protected]>
Date:   Thu May 22 11:05:59 2014 +1000

    put va_end() in the right place
    
    (cherry picked from commit d4825b278e28006bdc9c3f36ab174eade62d6c4c)

M       perlio.c
M       util.c

commit 5b1e7130c228acd74116fd5319cfb917dcebd12d
Author: Jarkko Hietaniemi <[email protected]>
Date:   Wed Apr 23 12:53:42 2014 -0400

    add va_end() calls where missing for a va_start() or va_end().
    
    Fix for Coverity perl5 CIDs 29225, 29226, 29227, 29228, 29229: Missing
    varargs init or cleanup (VARARGS) missing va_end: va_end was not
    called for foo.
    
    Use of va_args must be finished off with va_end (in other words,
    use of va_start or va_copy must be bracketed off with va_end).
    In most platforms va_end is a no-op, but in some platforms it is
    required for proper cleanup (or face stack smash, or memory leak).
    
    Tony: move va_start() out of the declaration block
    (cherry picked from commit 3ed3a8afebd64616aef147205403b96b30a4b4ee)

M       ext/PerlIO-via/via.xs
M       mathoms.c
M       perlio.c
M       util.c

commit e2cc8c0850918bc6e655349e3d487aab2dfbc045
Author: Jarkko Hietaniemi <[email protected]>
Date:   Wed May 7 09:30:35 2014 -0400

    fd closes for failure paths.
    
    Fix for Coverity perl5 CIDs 29053, 29055, 29057: Resource leak 
(RESOURCE_LEAK)
    leaked_handle: Handle variable fd going out of scope leaks the handle.
    
    (cherry picked from commit 0a20f69bae04ff02616da2f0128de4e842151093)

M       perlio.c

commit e3c3d49960409776be7ceb44108b0d0ed17b1706
Author: Jarkko Hietaniemi <[email protected]>
Date:   Wed May 7 09:25:04 2014 -0400

    slen may be uninitialized.
    
    Fix for Coverity perl5 CID 29081: Uninitialized scalar
    variable (UNINIT) uninit_use_in_call: Using uninitialized value slen when
    calling Perl_croak.
    
    If all fails, slen hasn't been set, and croak will be called with that.
    
    (cherry picked from commit 9b56a01971980348bbaf5753e47fcb59dee1ef49)

M       utf8.c

commit 568f0156c0fa55cbd563504b5d38de51d10f7dd9
Author: Jarkko Hietaniemi <[email protected]>
Date:   Wed May 7 09:26:52 2014 -0400

    Uninitialized tmbuf.
    
    Fix for Coverity perl5 CID 29088: Uninitialized scalar variable (UNINIT)
    uninit_use: Using uninitialized value tmbuf.tm_year.
    
    There is a code path that can lead to accessing uninitialized tmbuf:
    when the too-small or too-large time inputs to gmtime/localtime
    happen.
    
    - make it so that the tm_year is used only on successful code path:
      pp_sys.c
    - add the gmtime failed / localtime failed errors to perldiag:
      pod/perldiag.pod
    - test those errors: t/op/time.t
    
    (cherry picked from commit b35b96b6f8e35207d18b15dfcdbd0d08a7c6437c)

M       pod/perldiag.pod
M       pp_sys.c
M       t/op/time.t

commit 71ad52df39f4bb2979cd74ecc8cf0f855590e6ff
Author: Jarkko Hietaniemi <[email protected]>
Date:   Fri May 9 11:05:30 2014 -0400

    Do not invert a NULL cp_list.
    
    Fix for Coverity perl5 CID 28966.
    
    (cherry picked from commit e76fdebf5815ffaf53ebcfd2c7b78b0e9eacbfd2)

M       regcomp.c

commit ca1a72140c3f589cefe103637253a0db63d45165
Author: Jarkko Hietaniemi <[email protected]>
Date:   Mon May 19 06:52:24 2014 -0400

    Use the C_ARRAY_LENGTH.
    
    Use the C_ARRAY_LENGTH instead of sizeof(c_array)/sizeof(c_array[0])
    or sizeof(c_array)/sizeof(type_of_element_in_c_array), and C_ARRAY_END
    for c_array + C_ARRAY_LENGTH(c_array).
    
    While doing this found potential off-by-one error in sv.c:Perl_sv_magic:
    how > C_ARRAY_LENGTH(PL_magic_data)
    should probably have been
    how >= C_ARRAY_LENGTH(PL_magic_data)
    No tests fail, but this seems to be more of an internal sanity check.
    
    (cherry picked from commit c3caa5c3bdbd0ad0bc7ce5e7cd1a8eb5b7ca6a69)

M       dump.c
M       handy.h
M       patchlevel.h
M       perl.c
M       sv.c
M       universal.c
M       util.c

commit 3d66613332fa74fbb87e4da8862f0a044623af5b
Author: Jarkko Hietaniemi <[email protected]>
Date:   Wed May 7 09:22:16 2014 -0400

    Leaked string in failure path.
    
    Fix for Coverity perl5 CID 29058: Resource leak
    (RESOURCE_LEAK) leaked_storage: Variable codeset going out of scope leaks 
the
    storage it points to.
    
    The savepv-ed codeset was not freed in failure path.
    (The save_input_locale is freed just few lines later.)
    
    (cherry picked from commit 0ac78434bf60027f078daa1108d6c7bcec1ad6e4)

M       locale.c

commit 79a530fe6b30fe01f594e8df30eeaf59f44d5e61
Author: Jarkko Hietaniemi <[email protected]>
Date:   Fri May 9 18:49:25 2014 -0400

    si_names access one past the end.
    
    Fix for Coverity perl5 CID 45359.
    
    (cherry picked from commit 00b25eff1415ab27d5829f30fea1fecd57a7934e)

M       deb.c
-----------------------------------------------------------------------

Summary of changes:
 deb.c                     |  4 +++-
 dump.c                    |  5 ++---
 ext/PerlIO-via/via.pm     |  2 +-
 ext/PerlIO-via/via.xs     |  9 +++++----
 ext/XS-APItest/APItest.pm |  2 +-
 ext/XS-APItest/APItest.xs |  2 +-
 handy.h                   |  7 ++++++-
 locale.c                  |  1 +
 mathoms.c                 | 10 ++++++++--
 patchlevel.h              |  2 +-
 perl.c                    |  2 +-
 perlio.c                  |  4 ++++
 pod/perldiag.pod          | 10 ++++++++++
 pp_sys.c                  | 27 +++++++++++++--------------
 regcomp.c                 |  3 ++-
 sv.c                      |  5 ++---
 t/op/time.t               |  9 ++++++---
 universal.c               |  3 +--
 utf8.c                    |  2 +-
 util.c                    |  5 +++--
 20 files changed, 72 insertions(+), 42 deletions(-)

diff --git a/deb.c b/deb.c
index bccfc18..d16103e 100644
--- a/deb.c
+++ b/deb.c
@@ -217,7 +217,9 @@ Perl_deb_stack_all(pTHX)
     for (;;)
     {
         const size_t si_name_ix = si->si_type+1; /* -1 is a valid index */
-        const char * const si_name = (si_name_ix >= sizeof(si_names)) ? "????" 
: si_names[si_name_ix];
+        const char * const si_name =
+            si_name_ix < C_ARRAY_LENGTH(si_names) ?
+            si_names[si_name_ix] : "????";
        I32 ix;
        PerlIO_printf(Perl_debug_log, "STACK %"IVdf": %s\n",
                                                (IV)si_ix, si_name);
diff --git a/dump.c b/dump.c
index 354cd57..59be3e0 100644
--- a/dump.c
+++ b/dump.c
@@ -868,8 +868,7 @@ const struct op_private_by_op op_private_names[] = {
 static bool
 S_op_private_to_names(pTHX_ SV *tmpsv, U32 optype, U32 op_private) {
     const struct op_private_by_op *start = op_private_names;
-    const struct op_private_by_op *const end
-       = op_private_names + C_ARRAY_LENGTH(op_private_names);
+    const struct op_private_by_op *const end = C_ARRAY_END(op_private_names);
 
     /* This is a linear search, but no worse than the code that it replaced.
        It's debugging code - size is more important than speed.  */
@@ -1894,7 +1893,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, 
I32 nest, I32 maxnest, bo
        if (HvARRAY(sv) && usedkeys) {
            /* Show distribution of HEs in the ARRAY */
            int freq[200];
-#define FREQ_MAX ((int)(sizeof freq / sizeof freq[0] - 1))
+#define FREQ_MAX ((int)(C_ARRAY_LENGTH(freq) - 1))
            int i;
            int max = 0;
            U32 pow2 = 2, keys = usedkeys;
diff --git a/ext/PerlIO-via/via.pm b/ext/PerlIO-via/via.pm
index 77586f6..a10f7ee 100644
--- a/ext/PerlIO-via/via.pm
+++ b/ext/PerlIO-via/via.pm
@@ -1,5 +1,5 @@
 package PerlIO::via;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 require XSLoader;
 XSLoader::load();
 1;
diff --git a/ext/PerlIO-via/via.xs b/ext/PerlIO-via/via.xs
index 619174a..d7a037b 100644
--- a/ext/PerlIO-via/via.xs
+++ b/ext/PerlIO-via/via.xs
@@ -68,15 +68,16 @@ PerlIOVia_method(pTHX_ PerlIO * f, const char *method, CV 
** save, int flags,
                 ...)
 {
     PerlIOVia *s = PerlIOSelf(f, PerlIOVia);
+    SV *result = Nullsv;
     CV *cv =
        (*save) ? *save : PerlIOVia_fetchmethod(aTHX_ s, method, save);
-    SV *result = Nullsv;
-    va_list ap;
-    va_start(ap, flags);
     if (cv != (CV *) - 1) {
        IV count;
        dSP;
        SV *arg;
+        va_list ap;
+
+        va_start(ap, flags);
        PUSHSTACKi(PERLSI_MAGIC);
        ENTER;
        PUSHMARK(sp);
@@ -84,6 +85,7 @@ PerlIOVia_method(pTHX_ PerlIO * f, const char *method, CV ** 
save, int flags,
        while ((arg = va_arg(ap, SV *))) {
            XPUSHs(arg);
        }
+        va_end(ap);
        if (*PerlIONext(f)) {
            if (!s->fh) {
                GV *gv;
@@ -121,7 +123,6 @@ PerlIOVia_method(pTHX_ PerlIO * f, const char *method, CV 
** save, int flags,
        LEAVE;
        POPSTACK;
     }
-    va_end(ap);
     return result;
 }
 
diff --git a/ext/XS-APItest/APItest.pm b/ext/XS-APItest/APItest.pm
index 8c72b35..63ea858 100644
--- a/ext/XS-APItest/APItest.pm
+++ b/ext/XS-APItest/APItest.pm
@@ -5,7 +5,7 @@ use strict;
 use warnings;
 use Carp;
 
-our $VERSION = '0.60';
+our $VERSION = '0.60_01';
 
 require XSLoader;
 
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index a51924d..8e78736 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -3642,7 +3642,7 @@ test_get_vtbl()
        MGVTBL *want;
     CODE:
 #define test_get_this_vtable(name) \
-       want = CAT2(&PL_vtbl_, name); \
+       want = (MGVTBL*)CAT2(&PL_vtbl_, name); \
        have = get_vtbl(CAT2(want_vtbl_, name)); \
        if (have != want) \
            croak("fail %p!=%p for get_vtbl(want_vtbl_" STRINGIFY(name) ") at " 
__FILE__ " line %d", have, want, __LINE__)
diff --git a/handy.h b/handy.h
index 483a128..8e79a15 100644
--- a/handy.h
+++ b/handy.h
@@ -1938,8 +1938,13 @@ void Perl_mem_log_del_sv(const SV *sv, const char 
*filename, const int linenumbe
 #define StructCopy(s,d,t) Copy(s,d,1,t)
 #endif
 
+/* C_ARRAY_LENGTH is the number of elements in the C array (so you
+ * want your zero-based indices to be less than but not equal to).
+ *
+ * C_ARRAY_END is one past the last: half-open/half-closed range,
+ * not last-inclusive range. */
 #define C_ARRAY_LENGTH(a)      (sizeof(a)/sizeof((a)[0]))
-#define C_ARRAY_END(a)         (a) + (sizeof(a)/sizeof((a)[0]))
+#define C_ARRAY_END(a)         ((a) + C_ARRAY_LENGTH(a))
 
 #ifdef NEED_VA_COPY
 # ifdef va_copy
diff --git a/locale.c b/locale.c
index 6e8728c..a6aa431 100644
--- a/locale.c
+++ b/locale.c
@@ -1077,6 +1077,7 @@ S_is_cur_LC_category_utf8(pTHX_ int category)
                 Safefree(save_input_locale);
                 return is_utf8;
             }
+            Safefree(codeset);
         }
 
 #   endif
diff --git a/mathoms.c b/mathoms.c
index 73f1e8d..1132ac8 100644
--- a/mathoms.c
+++ b/mathoms.c
@@ -544,6 +544,7 @@ int
 Perl_fprintf_nocontext(PerlIO *stream, const char *format, ...)
 {
     dTHXs;
+    int ret = 0;
     va_list(arglist);
 
     /* Easier to special case this here than in embed.pl. (Look at what it
@@ -553,7 +554,9 @@ Perl_fprintf_nocontext(PerlIO *stream, const char *format, 
...)
 #endif
 
     va_start(arglist, format);
-    return PerlIO_vprintf(stream, format, arglist);
+    ret = PerlIO_vprintf(stream, format, arglist);
+    va_end(arglist);
+    return ret;
 }
 
 int
@@ -561,13 +564,16 @@ Perl_printf_nocontext(const char *format, ...)
 {
     dTHX;
     va_list(arglist);
+    int ret = 0;
 
 #ifdef PERL_IMPLICIT_CONTEXT
     PERL_ARGS_ASSERT_PRINTF_NOCONTEXT;
 #endif
 
     va_start(arglist, format);
-    return PerlIO_vprintf(PerlIO_stdout(), format, arglist);
+    ret = PerlIO_vprintf(PerlIO_stdout(), format, arglist);
+    va_end(arglist);
+    return ret;
 }
 
 #if defined(HUGE_VAL) || (defined(USE_LONG_DOUBLE) && defined(HUGE_VALL))
diff --git a/patchlevel.h b/patchlevel.h
index 1e8c6d5..8cbd286 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -144,7 +144,7 @@ static const char * const local_patches[] = {
 
 /* Initial space prevents this variable from being inserted in config.sh  */
 #  define      LOCAL_PATCH_COUNT       \
-       ((int)(sizeof(local_patches)/sizeof(local_patches[0])-2))
+       ((int)(C_ARRAY_LENGTH(local_patches)-2))
 
 /* the old terms of reference, add them only when explicitly included */
 #define PATCHLEVEL             PERL_VERSION
diff --git a/perl.c b/perl.c
index 27d0d9e..0fb87dc 100644
--- a/perl.c
+++ b/perl.c
@@ -677,7 +677,7 @@ perl_destruct(pTHXx)
                msg.msg_name = NULL;
                msg.msg_namelen = 0;
                msg.msg_iov = vec;
-               msg.msg_iovlen = sizeof(vec)/sizeof(vec[0]);
+               msg.msg_iovlen = C_ARRAY_LENGTH(vec);
 
                vec[0].iov_base = (void*)&target;
                vec[0].iov_len = sizeof(target);
diff --git a/perlio.c b/perlio.c
index d4c43d0..36bdb37 100644
--- a/perlio.c
+++ b/perlio.c
@@ -2661,6 +2661,7 @@ PerlIOUnix_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t 
*layers,
        }
        if (!PerlIOValid(f)) {
            if (!(f = PerlIO_push(aTHX_ f, self, mode, PerlIOArg))) {
+               PerlLIO_close(fd);
                return NULL;
            }
        }
@@ -2696,6 +2697,7 @@ PerlIOUnix_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS 
*param, int flags)
            PerlIOUnix_setfd(aTHX_ f, fd, os->oflags);
            return f;
        }
+        PerlLIO_close(fd);
     }
     return NULL;
 }
@@ -3050,6 +3052,7 @@ PerlIOStdio_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t 
*layers,
                }
                return f;
            }
+            PerlLIO_close(fd);
        }
     }
     return NULL;
@@ -4910,6 +4913,7 @@ PerlIO_vprintf(PerlIO *f, const char *fmt, va_list ap)
     va_list apc;
     Perl_va_copy(ap, apc);
     sv = vnewSVpvf(fmt, &apc);
+    va_end(apc);
 #else
     sv = vnewSVpvf(fmt, &ap);
 #endif
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index cb80d52..e4b861b 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -2121,6 +2121,11 @@ a term, so it's looking for the corresponding right 
angle bracket, and
 not finding it.  Chances are you left some needed parentheses out
 earlier in the line, and you really meant a "less than".
 
+=item gmtime(%f) failed
+
+(W overflow) You called C<gmtime> with a number that it could not handle:
+too large, too small, or NaN.  The returned value is C<undef>.
+
 =item gmtime(%f) too large
 
 (W overflow) You called C<gmtime> with a number that was larger than
@@ -2780,6 +2785,11 @@ L<perlfunc/listen>.
 form of C<open> does not support pipes, such as C<open($pipe, '|-', @args)>.
 Use the two-argument C<open($pipe, '|prog arg1 arg2...')> form instead.
 
+=item localtime(%f) failed
+
+(W overflow) You called C<localtime> with a number that it could not handle:
+too large, too small, or NaN.  The returned value is C<undef>.
+
 =item localtime(%f) too large
 
 (W overflow) You called C<localtime> with a number that was larger
diff --git a/pp_sys.c b/pp_sys.c
index 9f97177..43d6473 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -4483,30 +4483,29 @@ PP(pp_gmtime)
     }
 
     if (err == NULL) {
+       /* diag_listed_as: gmtime(%f) failed */
        /* XXX %lld broken for quads */
        Perl_ck_warner(aTHX_ packWARN(WARN_OVERFLOW),
                       "%s(%.0" NVff ") failed", opname, when);
     }
 
     if (GIMME != G_ARRAY) {    /* scalar context */
-       SV *tsv;
-       /* XXX newSVpvf()'s %lld type is broken, so cheat with a double */
-       double year = (double)tmbuf.tm_year + 1900;
-
         EXTEND(SP, 1);
         EXTEND_MORTAL(1);
        if (err == NULL)
            RETPUSHUNDEF;
-
-       tsv = Perl_newSVpvf(aTHX_ "%s %s %2d %02d:%02d:%02d %.0f",
-                           dayname[tmbuf.tm_wday],
-                           monname[tmbuf.tm_mon],
-                           tmbuf.tm_mday,
-                           tmbuf.tm_hour,
-                           tmbuf.tm_min,
-                           tmbuf.tm_sec,
-                           year);
-       mPUSHs(tsv);
+       else {
+           mPUSHs(Perl_newSVpvf(aTHX_ "%s %s %2d %02d:%02d:%02d %.0f",
+                                dayname[tmbuf.tm_wday],
+                                monname[tmbuf.tm_mon],
+                                tmbuf.tm_mday,
+                                tmbuf.tm_hour,
+                                tmbuf.tm_min,
+                                tmbuf.tm_sec,
+                                /* XXX newSVpvf()'s %lld type is broken,
+                                 * so cheat with a double */
+                                (double)tmbuf.tm_year + 1900));
+        }
     }
     else {                     /* list context */
        if ( err == NULL )
diff --git a/regcomp.c b/regcomp.c
index eaee604..165a3c2 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -14662,7 +14662,8 @@ parseit:
      * at compile time.  Besides not inverting folded locale now, we can't
      * invert if there are things such as \w, which aren't known until runtime
      * */
-    if (invert
+    if (cp_list
+        && invert
         && ! (ANYOF_FLAGS(ret) & (ANYOF_LOCALE_FLAGS))
        && ! depends_list
        && ! HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION)
diff --git a/sv.c b/sv.c
index 021385c..e1a93fa 100644
--- a/sv.c
+++ b/sv.c
@@ -5593,7 +5593,7 @@ Perl_sv_magic(pTHX_ SV *const sv, SV *const obj, const 
int how,
 
     PERL_ARGS_ASSERT_SV_MAGIC;
 
-    if (how < 0 || (unsigned)how > C_ARRAY_LENGTH(PL_magic_data)
+    if (how < 0 || (unsigned)how >= C_ARRAY_LENGTH(PL_magic_data)
        || ((flags = PL_magic_data[how]),
            (vtable_index = flags & PERL_MAGIC_VTABLE_MASK)
            > magic_vtable_max))
@@ -12274,8 +12274,7 @@ Perl_ptr_table_store(pTHX_ PTR_TBL_t *const tbl, const 
void *const oldsv, void *
            new_arena->next = tbl->tbl_arena;
            tbl->tbl_arena = new_arena;
            tbl->tbl_arena_next = new_arena->array;
-           tbl->tbl_arena_end = new_arena->array
-               + sizeof(new_arena->array) / sizeof(new_arena->array[0]);
+           tbl->tbl_arena_end = C_ARRAY_END(new_arena->array);
        }
 
        tblent = tbl->tbl_arena_next++;
diff --git a/t/op/time.t b/t/op/time.t
index 4ac7f5b..734b838 100644
--- a/t/op/time.t
+++ b/t/op/time.t
@@ -6,7 +6,7 @@ BEGIN {
     require './test.pl';
 }
 
-plan tests => 66;
+plan tests => 70;
 
 # These tests make sure, among other things, that we don't end up
 # burning tons of CPU for dates far in the future.
@@ -210,7 +210,7 @@ SKIP: { #rt #73040
        || $small_time == $smallest
         || $big_time - 200 != $biggest
        || $big_time == $biggest) {
-       skip "Can't represent test values", 4;
+       skip "Can't represent test values", 8;
     }
     my $small_time_f = sprintf("%.0f", $small_time);
     my $big_time_f = sprintf("%.0f", $big_time);
@@ -221,17 +221,20 @@ SKIP: { #rt #73040
     $warning = '';
     my $date = gmtime($big_time);
     like $warning, qr/^gmtime\($big_time_f\) too large/;
+    like $warning, qr/^gmtime\($big_time_f\) failed/m;
 
     $warning = '';
     $date = localtime($big_time);
     like $warning, qr/^localtime\($big_time_f\) too large/;
+    like $warning, qr/^localtime\($big_time_f\) failed/m;
 
     $warning = '';
     $date = gmtime($small_time);
     like $warning, qr/^gmtime\($small_time_f\) too small/;
+    like $warning, qr/^gmtime\($small_time_f\) failed/m;
 
     $warning = '';
     $date = localtime($small_time);
     like $warning, qr/^localtime\($small_time_f\) too small/;
-  
+    like $warning, qr/^localtime\($small_time_f\) failed/m;
 }
diff --git a/universal.c b/universal.c
index bccc8fb..a29696d 100644
--- a/universal.c
+++ b/universal.c
@@ -1059,8 +1059,7 @@ Perl_boot_core_UNIVERSAL(pTHX)
     dVAR;
     static const char file[] = __FILE__;
     const struct xsub_details *xsub = details;
-    const struct xsub_details *end
-       = details + sizeof(details) / sizeof(details[0]);
+    const struct xsub_details *end = C_ARRAY_END(details);
 
     do {
        newXS_flags(xsub->name, xsub->xsub, file, xsub->proto, 0);
diff --git a/utf8.c b/utf8.c
index 0ce3eb2..e97115f 100644
--- a/utf8.c
+++ b/utf8.c
@@ -2808,7 +2808,7 @@ Perl_swash_fetch(pTHX_ SV *swash, const U8 *ptr, bool 
do_utf8)
     HV *const hv = MUTABLE_HV(SvRV(swash));
     U32 klen;
     U32 off;
-    STRLEN slen;
+    STRLEN slen = 0;
     STRLEN needents;
     const U8 *tmps = NULL;
     U32 bit;
diff --git a/util.c b/util.c
index 3794848..998f0a0 100644
--- a/util.c
+++ b/util.c
@@ -4577,8 +4577,8 @@ Perl_init_global_struct(pTHX)
 {
     struct perl_vars *plvarsp = NULL;
 # ifdef PERL_GLOBAL_STRUCT
-    const IV nppaddr = sizeof(Gppaddr)/sizeof(Perl_ppaddr_t);
-    const IV ncheck  = sizeof(Gcheck) /sizeof(Perl_check_t);
+    const IV nppaddr = C_ARRAY_LENGTH(Gppaddr);
+    const IV ncheck  = C_ARRAY_LENGTH(Gcheck);
 #  ifdef PERL_GLOBAL_STRUCT_PRIVATE
     /* PerlMem_malloc() because can't use even safesysmalloc() this early. */
     plvarsp = (struct perl_vars*)PerlMem_malloc(sizeof(struct perl_vars));
@@ -4929,6 +4929,7 @@ Perl_my_vsnprintf(char *buffer, const Size_t len, const 
char *format, va_list ap
 # else
     retval = vsprintf(buffer, format, apc);
 # endif
+    va_end(apc);
 #else
 # ifdef HAS_VSNPRINTF
     retval = vsnprintf(buffer, len, format, ap);

--
Perl5 Master Repository

Reply via email to