summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2018-05-09 21:06:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-10 09:29:57 (GMT)
commitc112084af965ade0836b7c226c68ecd8b536fc0a (patch)
tree6d8b6b9c0e758832f8a8ac34b163bbc93433dee8 /http.c
parent27dea4683b608c5c0487dee74cbda13b62803b73 (diff)
downloadgit-c112084af965ade0836b7c226c68ecd8b536fc0a.zip
git-c112084af965ade0836b7c226c68ecd8b536fc0a.tar.gz
git-c112084af965ade0836b7c226c68ecd8b536fc0a.tar.bz2
fast-export: avoid NULL pointer arithmetic
Clang 6 reports the following warning, which is turned into an error in a DEVELOPER build: builtin/fast-export.c:162:28: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic] return ((uint32_t *)NULL) + mark; ~~~~~~~~~~~~~~~~~~ ^ 1 error generated. The compiler is correct, and the error message speaks for itself. There is no need for any undefined operation -- just cast mark to void * or uint32_t after an intermediate cast to uintptr_t. That encodes the integer value into a pointer and later decodes it as intended. While at it remove an outdated comment -- intptr_t has been used since ffe659f94d (parse-options: make some arguments optional, add callbacks), committed in October 2007. Signed-off-by: Rene Scharfe <l.s.r@web.de> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.c')
0 files changed, 0 insertions, 0 deletions