projects
/
ccan
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
291237b
)
memmem: Remove void * arithmetic warning
author
David Gibson
<david@gibson.dropbear.id.au>
Sun, 15 Jun 2014 09:12:11 +0000
(19:12 +1000)
committer
David Gibson
<david@gibson.dropbear.id.au>
Mon, 16 Jun 2014 15:50:00 +0000
(
01:50
+1000)
haystack is a void *, so we can't do pointer arithmetic on it uncasted.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
ccan/memmem/memmem.c
patch
|
blob
|
history
diff --git
a/ccan/memmem/memmem.c
b/ccan/memmem/memmem.c
index 4d3c2e62f75f8a9b057976e0ac10f0acd6deff90..48a6de2b18181f233fd71384ed0c5207b66e4429 100644
(file)
--- 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 <string.h>
#include <ccan/memmem/memmem.h>
@@
-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;