Fix handling of one case, should be a good memmem() now.

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@517 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
n-a-c-h 2008-05-20 01:54:20 +00:00
parent 4e8ab56781
commit 87fbce804c
1 changed files with 13 additions and 6 deletions

View File

@ -8,6 +8,8 @@
static uint8_t *memmem(const uint8_t *haystack, size_t haystacklen, const uint8_t *needle, size_t needlelen)
{
if (needlelen)
{
if (needlelen <= haystacklen)
{
haystacklen -= needlelen-1;
@ -20,6 +22,11 @@ static uint8_t *memmem(const uint8_t *haystack, size_t haystacklen, const uint8_
++haystack;
}
}
}
else
{
return((uint8_t *)haystack);
}
return(0);
}