From: David Gibson Date: Sun, 15 Jun 2014 09:12:11 +0000 (+1000) Subject: memmem: Remove void * arithmetic warning X-Git-Url: http://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=7bcba7662a50fe9f54009b0abe4a0e96aa6a4ea8 memmem: Remove void * arithmetic warning haystack is a void *, so we can't do pointer arithmetic on it uncasted. Signed-off-by: David Gibson --- diff --git a/ccan/memmem/memmem.c b/ccan/memmem/memmem.c index 4d3c2e62..48a6de2b 100644 --- a/ccan/memmem/memmem.c +++ b/ccan/memmem/memmem.c @@ -1,5 +1,7 @@ /* CC0 (Public domain) - see LICENSE file for details */ +#include "config.h" + #include #include @@ -15,7 +17,7 @@ void *memmem(const void *haystack, size_t haystacklen, p = haystack; for (p = haystack; - (p + needlelen) <= (haystack + haystacklen); + (p + needlelen) <= ((const char *)haystack + haystacklen); p++) if (memcmp(p, needle, needlelen) == 0) return (void *)p;