aboutsummaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-09-29 11:23:42 +0900
committerJunio C Hamano <gitster@pobox.com>2017-09-29 11:23:42 +0900
commit14a8168e2fed3934f1f9afb286f1c64345d06790 (patch)
treefc622bb0da0f89762a03bf6bb17b3bdc66e7eb92 /cache.h
parentd4d262d19e118faf29df842b752144da7c7af02e (diff)
parent071bcaab6480dea80a47f574f61dc2cd9518e7dc (diff)
downloadgit-14a8168e2fed3934f1f9afb286f1c64345d06790.tar.gz
git-14a8168e2fed3934f1f9afb286f1c64345d06790.tar.xz
Merge branch 'rj/no-sign-compare'
Many codepaths have been updated to squelch -Wsign-compare warnings. * rj/no-sign-compare: ALLOC_GROW: avoid -Wsign-compare warnings cache.h: hex2chr() - avoid -Wsign-compare warnings commit-slab.h: avoid -Wsign-compare warnings git-compat-util.h: xsize_t() - avoid -Wsign-compare warnings
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/cache.h b/cache.h
index 49b083ee0..ea6c236e0 100644
--- a/cache.h
+++ b/cache.h
@@ -1244,8 +1244,8 @@ static inline unsigned int hexval(unsigned char c)
*/
static inline int hex2chr(const char *s)
{
- int val = hexval(s[0]);
- return (val < 0) ? val : (val << 4) | hexval(s[1]);
+ unsigned int val = hexval(s[0]);
+ return (val & ~0xf) ? val : (val << 4) | hexval(s[1]);
}
/* Convert to/from hex/sha1 representation */