From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 962AD383E82C; Mon, 4 May 2020 09:21:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 962AD383E82C Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] localtime 1.82 X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: 3003c3dacd157c11f5e035bc18bdd30631800720 X-Git-Newrev: 489a47d6036660a6cbab1addfb2b7678c0de8bf2 Message-Id: <20200504092111.962AD383E82C@sourceware.org> Date: Mon, 4 May 2020 09:21:11 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 May 2020 09:21:11 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=489a47d6036660a6cbab1addfb2b7678c0de8bf2 commit 489a47d6036660a6cbab1addfb2b7678c0de8bf2 Author: Corinna Vinschen 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 */ /*