From 1aeb7e756c82d31e46712ec7557c4cbae37dccd9 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 21 Apr 2017 12:45:44 +0200 Subject: parse_timestamp(): specify explicitly where we parse timestamps Currently, Git's source code represents all timestamps as `unsigned long`. In preparation for using a more appropriate data type, let's introduce a symbol `parse_timestamp` (currently being defined to `strtoul`) where appropriate, so that we can later easily switch to, say, use `strtoull()` instead. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- date.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'date.c') diff --git a/date.c b/date.c index a996331f5b..495c207c64 100644 --- a/date.c +++ b/date.c @@ -510,7 +510,7 @@ static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt char *end; unsigned long num; - num = strtoul(date, &end, 10); + num = parse_timestamp(date, &end, 10); /* * Seconds since 1970? We trigger on that for any numbers with @@ -658,7 +658,7 @@ static int match_object_header_date(const char *date, unsigned long *timestamp, if (*date < '0' || '9' < *date) return -1; - stamp = strtoul(date, &end, 10); + stamp = parse_timestamp(date, &end, 10); if (*end != ' ' || stamp == ULONG_MAX || (end[1] != '+' && end[1] != '-')) return -1; date = end + 2; @@ -1066,7 +1066,7 @@ static const char *approxidate_digit(const char *date, struct tm *tm, int *num, time_t now) { char *end; - unsigned long number = strtoul(date, &end, 10); + unsigned long number = parse_timestamp(date, &end, 10); switch (*end) { case ':': -- cgit v1.2.3