[webkit-dev] Using memcmp

Patrick Hanna phanna at email.unc.edu
Tue Jun 30 09:57:42 PDT 2009


I have noticed that rather than using memcmp for comparing strings,  
webkit likes to cast to uint32_t* and compare in a for loop. For  
example, WebCore::equal in AtomicString.cpp and StringHash::equal in  
StringHash.h. Is there any reason not to memcmp? I am assuming that  
most implementations of memcmp will do the word alignment and  
basically do the same thing.

The reason I ask is because StringHash::equal does not check for  
PLATFORM(ARM) or PLATFORM(SH4) so I was going to submit a patch to use  
memcmp for ARM/SH4 but didn't know if that was frowned upon (and  
WebCore::equal does a loop for ARM/SH4 as well).

Thanks,
Patrick


More information about the webkit-dev mailing list