aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-01-27 20:40:48 +0100
committerMattias Andrée <m@maandree.se>2026-01-27 20:40:48 +0100
commit7e70c15821b6bdcc38c5e129d6332cc57edb9e0c (patch)
treee3ba75e908a495cafa873025f7fff43eca68266e
parentmemmem, memcasemem: use kmp algorithm (diff)
downloadlibsimple-7e70c15821b6bdcc38c5e129d6332cc57edb9e0c.tar.gz
libsimple-7e70c15821b6bdcc38c5e129d6332cc57edb9e0c.tar.bz2
libsimple-7e70c15821b6bdcc38c5e129d6332cc57edb9e0c.tar.xz
Add todoHEADmaster
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r--memcasemem.c2
-rw-r--r--memmem.c1
2 files changed, 3 insertions, 0 deletions
diff --git a/memcasemem.c b/memcasemem.c
index d883b62..625861a 100644
--- a/memcasemem.c
+++ b/memcasemem.c
@@ -10,6 +10,7 @@ libsimple_memcasemem(const void *hay_, size_t hayn, const void *sub_, size_t sub
const char *sub = sub_;
size_t *next, i, j;
+
if (!subn)
return REMOVE_CONST(hay, char *);
if (hayn < subn)
@@ -17,6 +18,7 @@ libsimple_memcasemem(const void *hay_, size_t hayn, const void *sub_, size_t sub
if (subn == 1)
return libsimple_memcasechr(hay, *sub, hayn);
+ /* TODO segment search if pattern is too large */
next = alloca((subn + 1U) * sizeof(*next));
i = 0, j = SIZE_MAX;
goto beginning;
diff --git a/memmem.c b/memmem.c
index 5d6e711..739f7e0 100644
--- a/memmem.c
+++ b/memmem.c
@@ -17,6 +17,7 @@ libsimple_memmem(const void *hay_, size_t hayn, const void *sub_, size_t subn)
if (subn == 1)
return memchr(hay, *sub, hayn);
+ /* TODO segment search if pattern is too large */
next = alloca((subn + 1U) * sizeof(*next));
i = 0, j = SIZE_MAX;
goto beginning;