mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
(long_time_expected_width): Don't test for failed localtime.
That cannot happen when the result date's year is in range. Add an assertion instead.
This commit is contained in:
1 parent
3623a168c4
commit
9a3ebcb54d
1 file changed
+9
-7
@@ -3068,13 +3068,15 @@ long_time_expected_width (void)
|
||||
struct tm const *tm = localtime (&epoch);
|
||||
char buf[TIME_STAMP_LEN_MAXIMUM + 1];
|
||||
|
||||
if (tm)
|
||||
{
|
||||
size_t len =
|
||||
nstrftime (buf, sizeof buf, long_time_format[0], tm, 0, 0);
|
||||
if (len != 0)
|
||||
width = mbsnwidth (buf, len, 0);
|
||||
}
|
||||
/* The above use of localtime cannot fail. */
|
||||
assert (tm != NULL);
|
||||
|
||||
{
|
||||
size_t len =
|
||||
nstrftime (buf, sizeof buf, long_time_format[0], tm, 0, 0);
|
||||
if (len != 0)
|
||||
width = mbsnwidth (buf, len, 0);
|
||||
}
|
||||
|
||||
if (width < 0)
|
||||
width = 0;
|
||||
|
||||
Reference in new issue
Block a user