From 835a5b33a1f6045fe3dd455fd555b67c58b46f41 Mon Sep 17 00:00:00 2001 Message-Id: <835a5b33a1f6045fe3dd455fd555b67c58b46f41.1714735627.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sat, 24 May 2008 17:21:20 +0100 Subject: [PATCH] Kill non-re-entrant xgetdate(). We don't use it so we might as well not build it. Organization: Straylight/Edgeware From: Richard Kettlewell Linux build fixes. --- lib/dateparse.h | 2 ++ lib/t-dateparse.c | 6 +++--- lib/xgetdate.c | 8 +++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/dateparse.h b/lib/dateparse.h index d86d14f..2f52dac 100644 --- a/lib/dateparse.h +++ b/lib/dateparse.h @@ -23,8 +23,10 @@ */ time_t dateparse(const char *s); +#if 0 struct tm *xgetdate(const char *string, const char *const *template); +#endif int xgetdate_r(const char *string, struct tm *tp, const char *const *template); diff --git a/lib/t-dateparse.c b/lib/t-dateparse.c index cd599e8..1e07c74 100644 --- a/lib/t-dateparse.c +++ b/lib/t-dateparse.c @@ -22,16 +22,16 @@ #include "dateparse.h" static void check_date(time_t when, - const char *format, + const char *fmt, struct tm *(*convert)(const time_t *)) { char buffer[128]; time_t parsed; - strftime(buffer, sizeof buffer, format, convert(&when)); + strftime(buffer, sizeof buffer, fmt, convert(&when)); parsed = dateparse(buffer); check_integer(parsed, when); if(parsed != when) - fprintf(stderr, "format=%s formatted=%s\n", format, buffer); + fprintf(stderr, "format=%s formatted=%s\n", fmt, buffer); } static void test_dateparse(void) { diff --git a/lib/xgetdate.c b/lib/xgetdate.c index de1c4d3..9d8b492 100644 --- a/lib/xgetdate.c +++ b/lib/xgetdate.c @@ -23,6 +23,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define _GNU_SOURCE 1 /* to expose strptime */ #include #include #include @@ -52,7 +53,7 @@ static int check_mday (int year, int mon, int mday); 8 invalid input specification Example: February 31 or a time is specified that can not be represented in a time_t (representing the time in seconds since 00:00:00 UTC, January 1, 1970) */ -int xgetdate_err; +/*int xgetdate_err;*/ /* Returns the first weekday WDAY of month MON in the year YEAR. */ @@ -208,7 +209,7 @@ xgetdate_r (const char *string, struct tm *tp, } - +#if 0 struct tm * xgetdate (const char *string, const char *const *template) { @@ -218,9 +219,10 @@ struct tm * if (errval != 0) { - getdate_err = errval; + xgetdate_err = errval; return NULL; } return &tmbuf; } +#endif -- [mdw]