[tz] [PROPOSED PATCH] Simplify strftime to pacify GCC 6.2
Paul Eggert
eggert at cs.ucla.edu
Mon Sep 12 14:45:21 UTC 2016
* strftime.c (strftime): Remove unnecessary checks against NULL
that provoke diagnostics from 'gcc -Wnonnull-compare'.
---
strftime.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/strftime.c b/strftime.c
index f75f9fd..151b2e9 100644
--- a/strftime.c
+++ b/strftime.c
@@ -137,14 +137,11 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *t)
tzset();
warn = IN_NONE;
- p = _fmt(((format == NULL) ? "%c" : format), t, s, s + maxsize, &warn);
+ p = _fmt(format, t, s, s + maxsize, &warn);
#ifndef NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU
if (warn != IN_NONE && getenv(YEAR_2000_NAME) != NULL) {
fprintf(stderr, "\n");
- if (format == NULL)
- fprintf(stderr, "NULL strftime format ");
- else fprintf(stderr, "strftime format \"%s\" ",
- format);
+ fprintf(stderr, "strftime format \"%s\" ", format);
fprintf(stderr, "yields only two digits of years in ");
if (warn == IN_SOME)
fprintf(stderr, "some locales");
--
2.7.4
More information about the tz
mailing list