[tz] [PROPOSED] Simplify recent zdump port
Paul Eggert
eggert at cs.ucla.edu
Tue Jan 25 19:19:50 UTC 2022
* zdump.c (tformat): Simplify by using default promotions.
---
zdump.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/zdump.c b/zdump.c
index 79ff1fd..be8ac30 100644
--- a/zdump.c
+++ b/zdump.c
@@ -1148,12 +1148,8 @@ tformat(void)
/* C11-style _Generic is more likely to return the correct
format when distinct types have the same size. */
char const *fmt =
- _Generic((time_t) 0,
- signed char: "%d", short: "%d", int: "%d",
- long: "%ld", long long: "%lld",
- char: CHAR_MAX <= INT_MAX ? "%d" : "%u",
- unsigned char: UCHAR_MAX <= INT_MAX ? "%d" : "%u",
- unsigned short: USHRT_MAX <= INT_MAX ? "%d" : "%u",
+ _Generic(+ (time_t) 0,
+ int: "%d", long: "%ld", long long: "%lld",
unsigned: "%u", unsigned long: "%lu",
unsigned long long: "%llu",
default: NULL);
--
2.34.1
More information about the tz
mailing list