diff options
| -rw-r--r-- | memcasemem.c | 2 | ||||
| -rw-r--r-- | memmem.c | 1 |
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; @@ -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; |
