Compress::Zlib 1.35
[p5sagit/p5-mst-13.2.git] / pp_sys.c
index 4430789..77613cb 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3543,11 +3543,10 @@ PP(pp_chdir)
 {
     dSP; dTARGET;
     const char *tmps = 0;
-    GV *gv = 0;
-    SV **svp;
+    GV *gv = NULL;
 
     if( MAXARG == 1 ) {
-       SV *sv = POPs;
+       SV * const sv = POPs;
         if (SvTYPE(sv) == SVt_PVGV) {
            gv = (GV*)sv;
         }
@@ -3560,10 +3559,13 @@ PP(pp_chdir)
     }
 
     if( !gv && (!tmps || !*tmps) ) {
-        if (    (svp = hv_fetch(GvHVn(PL_envgv), "HOME", 4, FALSE))
-             || (svp = hv_fetch(GvHVn(PL_envgv), "LOGDIR", 6, FALSE))
+       HV * const table = GvHVn(PL_envgv);
+       SV **svp;
+
+        if (    (svp = hv_fetch(table, "HOME", 4, FALSE))
+             || (svp = hv_fetch(table, "LOGDIR", 6, FALSE))
 #ifdef VMS
-             || (svp = hv_fetch(GvHVn(PL_envgv), "SYS$LOGIN", 9, FALSE))
+             || (svp = hv_fetch(table, "SYS$LOGIN", 9, FALSE))
 #endif
            )
         {
@@ -3581,7 +3583,7 @@ PP(pp_chdir)
     TAINT_PROPER("chdir");
     if (gv) {
 #ifdef HAS_FCHDIR
-       IO* io = GvIO(gv);
+       IO* const io = GvIO(gv);
        if (io) {
            if (IoIFP(io)) {
                PUSHi(fchdir(PerlIO_fileno(IoIFP(io))) >= 0);
@@ -3590,7 +3592,7 @@ PP(pp_chdir)
 #ifdef HAS_DIRFD
                PUSHi(fchdir(dirfd(IoDIRP(io))) >= 0);
 #else
-               DIE(aTHX PL_no_func, "dirfd");
+               DIE(aTHX_ PL_no_func, "dirfd");
 #endif
            }
            else {
@@ -4238,8 +4240,8 @@ PP(pp_system)
            if (did_pipes)
                PerlLIO_close(pp[1]);
 #ifndef PERL_MICRO
-           rsignal_save(SIGINT, SIG_IGN, &ihand);
-           rsignal_save(SIGQUIT, SIG_IGN, &qhand);
+           rsignal_save(SIGINT,  (Sighandler_t) SIG_IGN, &ihand);
+           rsignal_save(SIGQUIT, (Sighandler_t) SIG_IGN, &qhand);
 #endif
            do {
                result = wait4pid(childpid, &status, 0);
@@ -4570,14 +4572,16 @@ static struct tm *S_my_localtime (pTHX_ Time_t *tp)
      * Given that legal timezones are typically between GMT-12 and GMT+12
      * we turn back the clock 23 hours before calling the localtime
      * function, and add those to the return value. This will never cause
-     * day wrapping problems, since the edge case is Jan *19*
+     * day wrapping problems, since the edge case is Tue Jan *19*
      */
     T = *tp - 82800; /* 23 hour. allows up to GMT-23 */
     P = localtime (&T);
     P->tm_hour += 23;
     if (P->tm_hour >= 24) {
        P->tm_hour -= 24;
-       P->tm_mday++;
+       P->tm_mday++;   /* 18  -> 19  */
+       P->tm_wday++;   /* Mon -> Tue */
+       P->tm_yday++;   /* 18  -> 19  */
     }
     return (P);
 } /* S_my_localtime */