remove an useless null check in S_copy_little_tm_to_big_TM
authorDaniel Dragan <bulk88@hotmail.com>
Thu, 17 Jan 2013 07:52:45 +0000 (02:52 -0500)
committerAndy Dougherty <doughera@lafayette.edu>
Thu, 17 Jan 2013 15:32:59 +0000 (10:32 -0500)
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 .

time64.c

index 7b08d41..5ae5e7d 100644 (file)
--- a/time64.c
+++ b/time64.c
@@ -269,34 +269,29 @@ 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
-    }
+#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
 }