This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, libfortran] PR 47431 Thread-safe ctime/fdate intrinsics


On Thu, Jan 27, 2011 at 20:53, Tobias Burnus <burnus@net-b.de> wrote:
> On 01/25/2011 07:16 PM, Janne Blomqvist wrote:
>>
>> the attached patch makes the ctime and fdate intrinsics thread-safe by
>> using ctime_r() if available.
>>
>> Regtested on x86_64-unknown-linux-gnu, Ok for trunk?
>
> OK. Thanks for the patch. Do not forget the follow up bit of the patch.

Thanks. Committed, with the additional patch on top (not the
s/int/size_t/ thing which I fixed in the ttyname_r() patch, thanks for
reminding):

diff --git a/libgfortran/intrinsics/ctime.c b/libgfortran/intrinsics/ctime.c
index 5aae95f..2729616 100644
--- a/libgfortran/intrinsics/ctime.c
+++ b/libgfortran/intrinsics/ctime.c
@@ -45,7 +45,11 @@ see the files COPYING3 and COPYING.RUNTIME
respectively.  If not, see
 static char *
 ctime_r (const time_t * timep, char * buf __attribute__((unused)))
 {
+#ifdef HAVE_CTIME
   return ctime (timep);
+#else
+  return NULL;
+#endif
 }
 #endif


(Not that I expect HAVE_CTIME will ever be false, since it's part of C89).

Sending        libgfortran/ChangeLog
Sending        libgfortran/config.h.in
Sending        libgfortran/configure
Sending        libgfortran/configure.ac
Sending        libgfortran/intrinsics/ctime.c
Transmitting file data .....
Committed revision 169338.


>
> Tobias
>
> PS: I think PR 47491 and PR 47375 can be closed as fixed.

Yes, done.


-- 
Janne Blomqvist


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]