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:
parent
4e8ab56781
commit
87fbce804c
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
static uint8_t *memmem(const uint8_t *haystack, size_t haystacklen, const uint8_t *needle, size_t needlelen)
|
static uint8_t *memmem(const uint8_t *haystack, size_t haystacklen, const uint8_t *needle, size_t needlelen)
|
||||||
{
|
{
|
||||||
|
if (needlelen)
|
||||||
|
{
|
||||||
if (needlelen <= haystacklen)
|
if (needlelen <= haystacklen)
|
||||||
{
|
{
|
||||||
haystacklen -= needlelen-1;
|
haystacklen -= needlelen-1;
|
||||||
|
@ -20,6 +22,11 @@ static uint8_t *memmem(const uint8_t *haystack, size_t haystacklen, const uint8_
|
||||||
++haystack;
|
++haystack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return((uint8_t *)haystack);
|
||||||
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue