Skip to content

Commit 83915ba

Browse files
rscharfegitster
authored andcommitted
use labs() for variables of type long instead of abs()
Using abs() on long values can cause truncation, so use labs() instead. Reported by Clang 3.5 (-Wabsolute-value, enabled by -Wall). Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 7fa1365 commit 83915ba

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,9 @@ static int git_parse_signed(const char *value, intmax_t *ret, intmax_t max)
490490
errno = EINVAL;
491491
return 0;
492492
}
493-
uval = abs(val);
493+
uval = labs(val);
494494
uval *= factor;
495-
if (uval > max || abs(val) > uval) {
495+
if (uval > max || labs(val) > uval) {
496496
errno = ERANGE;
497497
return 0;
498498
}

0 commit comments

Comments
 (0)