|
|
Message-ID: <20260323071943.GS3520958@port70.net>
Date: Mon, 23 Mar 2026 08:19:43 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: Rich Felker <dalias@...c.org>
Cc: Hannu Nyman <hannu.nyman@....fi>, musl@...ts.openwall.com
Subject: Re: strptime in 1.2.6 - is tzname[0/1] guaranteed to be set?
* Rich Felker <dalias@...c.org> [2026-03-22 21:39:01 -0400]:
> char *strptime(const char *restrict s, const char *restrict f, struct tm *restrict tm)
> {
> int i, w, neg, adj, min, range, *dest, dummy;
> - const char *ex;
> + const char *ex, *s1;
> size_t len;
> int want_century = 0, century = 0, relyear = 0;
> while (*f) {
> @@ -207,16 +208,10 @@ char *strptime(const char *restrict s, const char *restrict f, struct tm *restri
> s += 5;
> break;
> case 'Z':
> - if (!strncmp(s, tzname[0], len = strlen(tzname[0]))) {
> - tm->tm_isdst = 0;
> - s += len;
> - } else if (!strncmp(s, tzname[1], len=strlen(tzname[1]))) {
> - tm->tm_isdst = 1;
> - s += len;
> - } else {
> - /* FIXME: is this supposed to be an error? */
> - while ((*s|32)-'a' <= 'z'-'a') s++;
> - }
> + s1 = s;
> + i = __tzname_to_isdst(&s1);
> + if (i>=0) tm->tm_isdst = i;
> + s = s1;
> break;
what is the point of
s1 = s;
foo(&s1);
s = s1;
seems equivalent to
foo(&s);
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.