Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
use labs() for variables of type long instead of abs()
author
René Scharfe
<l.s.r@web.de>
Sat, 15 Nov 2014 13:27:21 +0000
(14:27 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 17 Nov 2014 16:54:34 +0000
(08:54 -0800)
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>
config.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
7fa1365
)
diff --git
a/config.c
b/config.c
index 9e42d3832bbcce428705ef616d5b2008c47ec91a..dd5e9827882c67f20d880bc3c36a143cb0fdf82c 100644
(file)
--- a/
config.c
+++ b/
config.c
@@
-490,9
+490,9
@@
static int git_parse_signed(const char *value, intmax_t *ret, intmax_t max)
errno = EINVAL;
return 0;
}
- uval = abs(val);
+ uval =
l
abs(val);
uval *= factor;
- if (uval > max || abs(val) > uval) {
+ if (uval > max ||
l
abs(val) > uval) {
errno = ERANGE;
return 0;
}