Module Name: src Committed By: riastradh Date: Sat Mar 16 00:16:21 UTC 2024
Modified Files: src/lib/libc/time: strptime.c Log Message: strptime(3): Reduce unnecessary indentation. Post-fix tidying. No functional change intended. PR lib/58041 To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/lib/libc/time/strptime.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/time/strptime.c diff -u src/lib/libc/time/strptime.c:1.64 src/lib/libc/time/strptime.c:1.65 --- src/lib/libc/time/strptime.c:1.64 Sat Mar 16 00:06:45 2024 +++ src/lib/libc/time/strptime.c Sat Mar 16 00:16:21 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: strptime.c,v 1.64 2024/03/16 00:06:45 riastradh Exp $ */ +/* $NetBSD: strptime.c,v 1.65 2024/03/16 00:16:21 riastradh Exp $ */ /*- * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: strptime.c,v 1.64 2024/03/16 00:06:45 riastradh Exp $"); +__RCSID("$NetBSD: strptime.c,v 1.65 2024/03/16 00:16:21 riastradh Exp $"); #endif #include "namespace.h" @@ -346,41 +346,40 @@ literal: LEGAL_ALT(ALT_O); continue; - case 's': /* seconds since the epoch */ - { - const time_t TIME_MAX = __type_max(time_t); - time_t sse; - unsigned d; + case 's': { /* seconds since the epoch */ + const time_t TIME_MAX = __type_max(time_t); + time_t sse; + unsigned d; - if (*bp < '0' || *bp > '9') { - bp = NULL; - continue; - } + if (*bp < '0' || *bp > '9') { + bp = NULL; + continue; + } - sse = *bp++ - '0'; - while (*bp >= '0' && *bp <= '9') { - d = *bp++ - '0'; - if (sse > TIME_MAX/10) { - bp = NULL; - break; - } - sse *= 10; - if (sse > TIME_MAX - d) { - bp = NULL; - break; - } - sse += d; + sse = *bp++ - '0'; + while (*bp >= '0' && *bp <= '9') { + d = *bp++ - '0'; + if (sse > TIME_MAX/10) { + bp = NULL; + break; } - if (bp == NULL) - continue; - - if (localtime_r(&sse, tm) == NULL) + sse *= 10; + if (sse > TIME_MAX - d) { bp = NULL; - else - state |= S_YDAY | S_WDAY | - S_MON | S_MDAY | S_YEAR; + break; + } + sse += d; } + if (bp == NULL) + continue; + + if (localtime_r(&sse, tm) == NULL) + bp = NULL; + else + state |= S_YDAY | S_WDAY | + S_MON | S_MDAY | S_YEAR; continue; + } case 'U': /* The week of year, beginning on sunday. */ case 'W': /* The week of year, beginning on monday. */