diff options
author | Kai Tietz <kai.tietz@onevision.com> | 2011-01-29 17:20:13 +0000 |
---|---|---|
committer | Kai Tietz <ktietz@gcc.gnu.org> | 2011-01-29 18:20:13 +0100 |
commit | 69ca976728b43ad84f9a8e3be9aaf852cdee8a8f (patch) | |
tree | ea0369a7724abfcaa713c74e259dec3b6eebb26e /libgfortran/intrinsics | |
parent | ca7174cf5ce7f23e06aa453e2d632ed5e4eac867 (diff) | |
download | gcc-69ca976728b43ad84f9a8e3be9aaf852cdee8a8f.zip gcc-69ca976728b43ad84f9a8e3be9aaf852cdee8a8f.tar.gz gcc-69ca976728b43ad84f9a8e3be9aaf852cdee8a8f.tar.bz2 |
ctime.c (ctime_r): Improve implementation.
2011-01-29 Kai Tietz <kai.tietz@onevision.com>
* intrinsics/ctime.c (ctime_r): Improve implementation.
From-SVN: r169389
Diffstat (limited to 'libgfortran/intrinsics')
-rw-r--r-- | libgfortran/intrinsics/ctime.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libgfortran/intrinsics/ctime.c b/libgfortran/intrinsics/ctime.c index 2729616..b7b463c 100644 --- a/libgfortran/intrinsics/ctime.c +++ b/libgfortran/intrinsics/ctime.c @@ -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 |