aboutsummaryrefslogtreecommitdiffstats
path: root/memelem.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--memelem.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/memelem.c b/memelem.c
index ceca578..43cb298 100644
--- a/memelem.c
+++ b/memelem.c
@@ -43,9 +43,14 @@ libsimple_memelem(const void *hay_, size_t hayn, const void *sub_, size_t subn)
{
char *hay = (void *)hay_;
const char *sub = sub_;
- for (; hayn--; hay += subn)
- if (!memcmp(hay, sub, subn))
- return hay;
+ size_t i;
+ for (; hayn--; hay += subn) {
+ for (i = 0; i < subn; i++)
+ if (hay[i] != sub[i])
+ goto next;
+ return hay;
+ next:;
+ }
break;
}