summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-10-23 14:20:18 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-10-23 14:20:18 +0900
commit7186408f2486ebbb82736c15efb8fbc372fb5f95 (patch)
treeb17026dbf30f239cbb390e0ee33b109ef69b0370 /cache.h
parentMerge branch 'ma/ts-cleanups' into maint (diff)
parentALLOC_GROW: avoid -Wsign-compare warnings (diff)
downloadtgif-7186408f2486ebbb82736c15efb8fbc372fb5f95.tar.xz
Merge branch 'rj/no-sign-compare' into maint
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 849bc0dcdd..5cc116ba42 100644
--- a/cache.h
+++ b/cache.h
@@ -1264,8 +1264,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 */