This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Merge pull request #71 from richardleach/patch-1
[metaconfig.git] / U / threads / d_localtime_r.U
index d944f89..53fa397 100644 (file)
@@ -52,8 +52,8 @@
 ?C:    REENTRANT_PROTO_T_ABC macros of reentr.h if d_localtime_r
 ?C:    is defined.
 ?C:.
-?H:#$d_localtime_r HAS_LOCALTIME_R        /**/
-?H:#define LOCALTIME_R_PROTO $localtime_r_proto           /**/
+?H:#$d_localtime_r HAS_LOCALTIME_R     /**/
+?H:#define LOCALTIME_R_PROTO $localtime_r_proto        /**/
 ?H:.
 ?T:try hdrs d_localtime_r_proto
 ?F:!try
@@ -81,7 +81,7 @@ case "$d_localtime_r" in
        esac
        case "$localtime_r_proto" in
        ''|0)   d_localtime_r=undef
-               localtime_r_proto=0
+               localtime_r_proto=0
                echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
        * )     case "$localtime_r_proto" in
                REENTRANT_PROTO*) ;;
@@ -132,6 +132,7 @@ REENTRANT_PROTO*)
 #endif
 int main()
 {
+    int result = 0;
     time_t t = time(0L);
     char w_tz[]="TZ" "=GMT+5",
         e_tz[]="TZ" "=GMT-5",
@@ -150,8 +151,10 @@ int main()
     localtime_r(&t, &tm_w);
 
     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
-       return 1;
-    return 0;
+       result = 1;
+
+    free(tz_e);free(tz_w);
+    return result;
 }
 EOCP
        set try