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 <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
efac8ac84b
commit
1aeb7e756c
2
fsck.c
2
fsck.c
@ -691,7 +691,7 @@ static int fsck_ident(const char **ident, struct object *obj, struct fsck_option
|
||||
p++;
|
||||
if (*p == '0' && p[1] != ' ')
|
||||
return report(options, obj, FSCK_MSG_ZERO_PADDED_DATE, "invalid author/committer line - zero-padded date");
|
||||
if (date_overflows(strtoul(p, &end, 10)))
|
||||
if (date_overflows(parse_timestamp(p, &end, 10)))
|
||||
return report(options, obj, FSCK_MSG_BAD_DATE_OVERFLOW, "invalid author/committer line - date causes integer overflow");
|
||||
if ((end == p || *end != ' '))
|
||||
return report(options, obj, FSCK_MSG_BAD_DATE, "invalid author/committer line - bad date");
|
||||
|
Reference in New Issue
Block a user