mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
boring tr_memmem tweaks
This commit is contained in:
parent
af213891f9
commit
d0a84bcf09
1 changed files with 2 additions and 6 deletions
|
@ -694,14 +694,10 @@ tr_memmem( const char * haystack, size_t haystacklen,
|
|||
#ifdef HAVE_MEMMEM
|
||||
return memmem( haystack, haystacklen, needle, needlelen );
|
||||
#else
|
||||
const char *h = haystack;
|
||||
const char *n = needle;
|
||||
size_t i;
|
||||
|
||||
for( i=0; i<haystacklen-needlelen; ++i )
|
||||
if( !memcmp( h+i, n, needlelen ) )
|
||||
return h+i;
|
||||
|
||||
if( !memcmp( haystack+i, needle, needlelen ) )
|
||||
return haystack+i;
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue