aboutsummaryrefslogtreecommitdiffstats
path: root/memrelem.c
diff options
context:
space:
mode:
Diffstat (limited to 'memrelem.c')
-rw-r--r--memrelem.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/memrelem.c b/memrelem.c
index e26ebe6..b1e69ba 100644
--- a/memrelem.c
+++ b/memrelem.c
@@ -50,10 +50,14 @@ libsimple_memrelem(const void *hay_, size_t hayn, const void *sub_, size_t subn)
{
char *hay = (void *)hay_;
const char *sub = sub_;
+ size_t i;
for (hay += hayn * subn; hayn--;) {
hay -= subn;
- if (!memcmp(hay, sub, subn))
- return hay;
+ for (i = 0; i < subn; i++)
+ if (hay[i] != sub[i])
+ goto next;
+ return hay;
+ next:;
}
break;