mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-01-31 01:39:15 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user