Skip to content

Commit 06188ea

Browse files
rscharfegitster
authored andcommitted
config: use git_parse_int() in git_config_get_expiry_in_days()
git_config_get_expiry_in_days() calls git_parse_signed() with the maximum value of int, which is equivalent to calling git_parse_int(). Do that instead, as its shorter and clearer. This requires demoting "days" to int to match. Promote "scale" to intmax_t in turn to arrive at the same result when multiplying them. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 9a2fb14 commit 06188ea

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

config.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,14 +2434,14 @@ int repo_config_get_expiry_in_days(struct repository *r, const char *key,
24342434
timestamp_t *expiry, timestamp_t now)
24352435
{
24362436
const char *expiry_string;
2437-
intmax_t days;
2437+
int days;
24382438
timestamp_t when;
24392439

24402440
if (repo_config_get_string_tmp(r, key, &expiry_string))
24412441
return 1; /* no such thing */
24422442

2443-
if (git_parse_signed(expiry_string, &days, maximum_signed_value_of_type(int))) {
2444-
const int scale = 86400;
2443+
if (git_parse_int(expiry_string, &days)) {
2444+
const intmax_t scale = 86400;
24452445
*expiry = now - days * scale;
24462446
return 0;
24472447
}

0 commit comments

Comments
 (0)