summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2019-07-09 15:25:41 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-07-09 15:25:41 -0700
commit7785f9ba030674671eb78ccfd2358f6903b632fb (patch)
tree53fbdf7f2d933eba81f87f3018a50d135c172f23 /config.c
parentMerge branch 'dl/includeif-onbranch' (diff)
parentconfig: avoid calling `labs()` on too-large data type (diff)
downloadtgif-7785f9ba030674671eb78ccfd2358f6903b632fb.tar.xz
Merge branch 'js/gcc-8-and-9'
Code clean-up for new compilers. * js/gcc-8-and-9: config: avoid calling `labs()` on too-large data type winansi: simplify loading the GetCurrentConsoleFontEx() function kwset: allow building with GCC 8 poll (mingw): allow compiling with GCC 8 and DEVELOPER=1
Diffstat (limited to 'config.c')
-rw-r--r--config.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/config.c b/config.c
index ad4166e243..972d3c1033 100644
--- a/config.c
+++ b/config.c
@@ -896,9 +896,9 @@ static int git_parse_signed(const char *value, intmax_t *ret, intmax_t max)
errno = EINVAL;
return 0;
}
- uval = labs(val);
+ uval = val < 0 ? -val : val;
uval *= factor;
- if (uval > max || labs(val) > uval) {
+ if (uval > max || (val < 0 ? -val : val) > uval) {
errno = ERANGE;
return 0;
}