mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +00:00
(trunk) dht seems to be crashing in bcmp() on the mac, so I suspect the homegrown implementation of memmem() is buggy... test this out by replacing memmem()'s implementation
This commit is contained in:
@@ -695,7 +695,11 @@ tr_memmem( const char * haystack, size_t haystacklen,
|
||||
return memmem( haystack, haystacklen, needle, needlelen );
|
||||
#else
|
||||
size_t i;
|
||||
for( i=0; i<haystacklen-needlelen; ++i )
|
||||
if( !needlelen )
|
||||
return haystack;
|
||||
if( needlelen > haystacklen || !haystack || !needle )
|
||||
return NULL;
|
||||
for( i=0; i<=haystacklen-needlelen; ++i )
|
||||
if( !memcmp( haystack+i, needle, needlelen ) )
|
||||
return haystack+i;
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user