In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/606599e1b75bd972167796e8a3f88a7821d3d8c6?hp=9816f1212fba0148b8edf3072e3d0b121e313665>

- Log -----------------------------------------------------------------
commit 606599e1b75bd972167796e8a3f88a7821d3d8c6
Author: Andy Dougherty <[email protected]>
Date:   Thu Jan 17 10:34:33 2013 -0500

    Added asserts() to check the arguments to S_copy_little_tm_to_big_TM.
    
    The original version just zeroed dest if src == NULL, but that code path
    was never used.  (gcc -Os inlined the function and optimized the test
    away anyway.)

M       time64.c

commit 55971e212352fca42631e1c6c7cadd0eb3affbd0
Author: Daniel Dragan <[email protected]>
Date:   Thu Jan 17 02:52:45 2013 -0500

    remove an useless null check in S_copy_little_tm_to_big_TM
    
    All callers of S_copy_little_tm_to_big_TM pass a true variable src.
    Checking for null is pointless. On Win32 32 bit VC 2003 -O1 -GL,
    perl517.dll's .text section went from 0xCO13F to 0xC012F bytes long. It can
    be argued that the compiler should have figured this out on its own, but VC
    for whatever reason didn't. Also pretty the indenting and align the
    assignments. The null check blames to commit 806a119aef .

M       time64.c
-----------------------------------------------------------------------

Summary of changes:
 time64.c |   53 +++++++++++++++++++++++++----------------------------
 1 files changed, 25 insertions(+), 28 deletions(-)

diff --git a/time64.c b/time64.c
index 7b08d41..8cbfa7c 100644
--- a/time64.c
+++ b/time64.c
@@ -269,34 +269,31 @@ static int S_safe_year(Year year)
 
 
 static void S_copy_little_tm_to_big_TM(const struct tm *src, struct TM *dest) {
-    if( src == NULL ) {
-        memset(dest, 0, sizeof(*dest));
-    }
-    else {
-#       ifdef USE_TM64
-            dest->tm_sec        = src->tm_sec;
-            dest->tm_min        = src->tm_min;
-            dest->tm_hour       = src->tm_hour;
-            dest->tm_mday       = src->tm_mday;
-            dest->tm_mon        = src->tm_mon;
-            dest->tm_year       = (Year)src->tm_year;
-            dest->tm_wday       = src->tm_wday;
-            dest->tm_yday       = src->tm_yday;
-            dest->tm_isdst      = src->tm_isdst;
-
-#           ifdef HAS_TM_TM_GMTOFF
-                dest->tm_gmtoff  = src->tm_gmtoff;
-#           endif
-
-#           ifdef HAS_TM_TM_ZONE
-                dest->tm_zone  = src->tm_zone;
-#           endif
-
-#       else
-            /* They're the same type */
-            memcpy(dest, src, sizeof(*dest));
-#       endif
-    }
+    assert(src);
+    assert(dest);
+#ifdef USE_TM64
+    dest->tm_sec        = src->tm_sec;
+    dest->tm_min        = src->tm_min;
+    dest->tm_hour       = src->tm_hour;
+    dest->tm_mday       = src->tm_mday;
+    dest->tm_mon        = src->tm_mon;
+    dest->tm_year       = (Year)src->tm_year;
+    dest->tm_wday       = src->tm_wday;
+    dest->tm_yday       = src->tm_yday;
+    dest->tm_isdst      = src->tm_isdst;
+
+#  ifdef HAS_TM_TM_GMTOFF
+    dest->tm_gmtoff     = src->tm_gmtoff;
+#  endif
+
+#  ifdef HAS_TM_TM_ZONE
+    dest->tm_zone       = src->tm_zone;
+#  endif
+
+#else
+    /* They're the same type */
+    memcpy(dest, src, sizeof(*dest));
+#endif
 }
 
 

--
Perl5 Master Repository

Reply via email to