]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ctime.c (ctime_r): Improve implementation.
authorKai Tietz <kai.tietz@onevision.com>
Sat, 29 Jan 2011 17:20:13 +0000 (17:20 +0000)
committerKai Tietz <ktietz@gcc.gnu.org>
Sat, 29 Jan 2011 17:20:13 +0000 (18:20 +0100)
2011-01-29  Kai Tietz  <kai.tietz@onevision.com>

        * intrinsics/ctime.c (ctime_r): Improve implementation.

From-SVN: r169389

libgfortran/ChangeLog
libgfortran/intrinsics/ctime.c

index 2515ca5e38a3cd36ba15b756626e3a315920050d..5e0c7623e97237c76685080547e1f022e468964f 100644 (file)
@@ -1,3 +1,7 @@
+2011-01-29  Kai Tietz  <kai.tietz@onevision.com>
+
+       * intrinsics/ctime.c (ctime_r): Improve implementation.
+
 2011-01-27  Janne Blomqvist  <jb@gcc.gnu.org>
 
        PR libfortran/47431
index 2729616bff07cb3853e6978d11aaa30eca367235..b7b463c3aca881712d268dc2b68b7cf61cf5db12 100644 (file)
@@ -42,11 +42,17 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 
 #ifndef HAVE_CTIME_R
+/* Make sure we don't see here a macro.  */
+#undef ctime_r
+
 static char *
 ctime_r (const time_t * timep, char * buf __attribute__((unused)))
 {
 #ifdef HAVE_CTIME
-  return ctime (timep);
+  char *tmp = ctime (timep);
+  if (tmp)
+    tmp = strcpy (buf, tmp);
+  return tmp;
 #else
   return NULL;
 #endif