public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] localtime 1.82
@ 2020-05-04  9:21 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2020-05-04  9:21 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=489a47d6036660a6cbab1addfb2b7678c0de8bf2

commit 489a47d6036660a6cbab1addfb2b7678c0de8bf2
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Tue Apr 28 21:35:41 2020 +0200

    localtime 1.82

Diff:
---
 winsup/cygwin/localtime.cc | 37 +++++++++++++++----------------------
 1 file changed, 15 insertions(+), 22 deletions(-)

diff --git a/winsup/cygwin/localtime.cc b/winsup/cygwin/localtime.cc
index 7324fbd98..dccaa623a 100644
--- a/winsup/cygwin/localtime.cc
+++ b/winsup/cygwin/localtime.cc
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.81 2013/12/26 18:34:28 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.82 2014/05/13 16:33:56 christos Exp $	*/
 
 /*
 ** This file is in the public domain, so clarified as of
@@ -88,7 +88,7 @@ static char	privatehid[] = "@(#)private.h	7.48";
 #if 0
 static char	elsieid[] = "@(#)localtime.cc	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.81 2013/12/26 18:34:28 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.82 2014/05/13 16:33:56 christos Exp $");
 #endif
 
 /*
@@ -678,7 +678,7 @@ tzload(timezone_t sp, const char *name, const int doextend)
 	u_t *			up;
 	save_errno		save;
 
-	up = (u_t *) calloc(1, sizeof *up);
+	up = (u_t *) malloc(sizeof *up);
 	if (up == NULL)
 		return -1;
 
@@ -1377,6 +1377,7 @@ tzparse(timezone_t sp, const char *name, const int lastditch)
 			sp->ttis[1].tt_gmtoff = -stdoffset;
 			sp->ttis[1].tt_isdst = 0;
 			sp->ttis[1].tt_abbrind = 0;
+			sp->defaulttype = 0;
 			timecnt = 0;
 			janfirst = 0;
 			sp->timecnt = 0;
@@ -1514,6 +1515,7 @@ tzparse(timezone_t sp, const char *name, const int lastditch)
 			sp->ttis[1].tt_isdst = TRUE;
 			sp->ttis[1].tt_abbrind = (int)(stdlen + 1);
 			sp->typecnt = 2;
+			sp->defaulttype = 0;
 			/*
 			** Get zone offsets into tzinfo (for newlib). . .
 			*/
@@ -1533,6 +1535,7 @@ tzparse(timezone_t sp, const char *name, const int lastditch)
 		sp->ttis[0].tt_gmtoff = -stdoffset;
 		sp->ttis[0].tt_isdst = 0;
 		sp->ttis[0].tt_abbrind = 0;
+		sp->defaulttype = 0;
 		/*
 		** Get zone offsets into tzinfo (for newlib). . .
 		*/
@@ -1581,7 +1584,7 @@ tzsetwall (void)
 
 	if (lclptr == NULL) {
 		save_errno save;
-		lclptr = (timezone_t) calloc(1, sizeof *lclptr);
+		lclptr = (timezone_t) malloc(sizeof *lclptr);
 		if (lclptr == NULL) {
 			settzname();	/* all we can do */
 			return;
@@ -1704,7 +1707,7 @@ tzset_unlocked(void)
 
 	if (lclptr == NULL) {
 		save_errno save;
-		lclptr = (timezone_t) calloc(1, sizeof *lclptr);
+		lclptr = (timezone_t) malloc(sizeof *lclptr);
 		if (lclptr == NULL) {
 			settzname();	/* all we can do */
 			return;
@@ -1857,7 +1860,7 @@ gmtsub(const timezone_t sp, const time_t *const timep,
 	if (!gmt_is_set) {
 		save_errno save;
 		gmt_is_set = TRUE;
-		gmtptr = (timezone_t) calloc(1, sizeof *gmtptr);
+		gmtptr = (timezone_t) malloc(sizeof *gmtptr);
 		if (gmtptr != NULL)
 			gmtload(gmtptr);
 	}
@@ -1870,15 +1873,7 @@ gmtsub(const timezone_t sp, const time_t *const timep,
 	** but this is no time for a treasure hunt.
 	*/
 	if (CYGWIN_VERSION_CHECK_FOR_EXTRA_TM_MEMBERS)
-	  {
-	    if (offset != 0)
-		    tmp->TM_ZONE = wildabbr;
-	    else {
-		    if (gmtptr == NULL)
-			    tmp->TM_ZONE = gmt;
-		    else	tmp->TM_ZONE = gmtptr->chars;
-	    }
-	  }
+	  tmp->TM_ZONE = offset ? wildabbr : gmtptr ? gmtptr->chars : gmt;
 #endif /* defined TM_ZONE */
 	return result;
 }
@@ -2439,17 +2434,15 @@ time1(const timezone_t sp, struct tm *const tmp, subfun_t funcp,
 	if (tmp->tm_isdst > 1)
 		tmp->tm_isdst = 1;
 	t = time2(sp, tmp, funcp, offset, &okay);
-#ifdef PCTS
-	/*
-	** PCTS code courtesy Grant Sullivan.
-	*/
 	if (okay)
 		return t;
 	if (tmp->tm_isdst < 0)
+#ifdef PCTS
+		/*
+		** POSIX Conformance Test Suite code courtesy Grant Sullivan.
+		*/
 		tmp->tm_isdst = 0;	/* reset to std and try again */
-#endif /* defined PCTS */
-#ifndef PCTS
-	if (okay || tmp->tm_isdst < 0)
+#else
 		return t;
 #endif /* !defined PCTS */
 	/*


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-04  9:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-04  9:21 [newlib-cygwin] localtime 1.82 Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).