diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2017-04-21 12:45:44 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-04-23 20:19:15 -0700 |
commit | 1aeb7e756c82d31e46712ec7557c4cbae37dccd9 (patch) | |
tree | ab7e2a304b1a310d112bd168babd76b88714be2e /builtin | |
parent | t0006 & t5000: skip "far in the future" test when time_t is too limited (diff) | |
download | tgif-1aeb7e756c82d31e46712ec7557c4cbae37dccd9.tar.xz |
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>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/am.c | 2 | ||||
-rw-r--r-- | builtin/receive-pack.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/builtin/am.c b/builtin/am.c index f7a7a971fb..2c93adc69c 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -882,7 +882,7 @@ static int hg_patch_to_mail(FILE *out, FILE *in, int keep_cr) char *end; errno = 0; - timestamp = strtoul(str, &end, 10); + timestamp = parse_timestamp(str, &end, 10); if (errno) return error(_("invalid timestamp")); diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 3cba3fd278..9a4c2a7ade 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -534,7 +534,7 @@ static const char *check_nonce(const char *buf, size_t len) retval = NONCE_BAD; goto leave; } - stamp = strtoul(nonce, &bohmac, 10); + stamp = parse_timestamp(nonce, &bohmac, 10); if (bohmac == nonce || bohmac[0] != '-') { retval = NONCE_BAD; goto leave; @@ -552,7 +552,7 @@ static const char *check_nonce(const char *buf, size_t len) * would mean it was issued by another server with its clock * skewed in the future. */ - ostamp = strtoul(push_cert_nonce, NULL, 10); + ostamp = parse_timestamp(push_cert_nonce, NULL, 10); nonce_stamp_slop = (long)ostamp - (long)stamp; if (nonce_stamp_slop_limit && |