Merge pull request #7996 from julek-wolfssl/move-mymemmem

memmem is only being used in testing so move it there

Failing test is disabled in: 5be198fa0e
This commit is contained in:
András Fekete
2024-09-20 09:08:44 -04:00
committed by GitHub
5 changed files with 23 additions and 26 deletions

View File

@@ -3397,25 +3397,6 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n)
}
#endif
void *mymemmem(const void *haystack, size_t haystacklen,
const void *needle, size_t needlelen)
{
size_t i, j;
const char* h = (const char*)haystack;
const char* n = (const char*)needle;
if (needlelen > haystacklen)
return NULL;
for (i = 0; i <= haystacklen - needlelen; i++) {
for (j = 0; j < needlelen; j++) {
if (h[i + j] != n[j])
break;
}
if (j == needlelen)
return (void*)(h + i);
}
return NULL;
}
/* custom memory wrappers */
#ifdef WOLFSSL_NUCLEUS_1_2