clean up strequal()?

Martin Pool mbp at samba.org
Wed Apr 9 05:30:36 GMT 2003


After a conversation with tridge this morning:

The strequal() function in Samba is a relic of an older version where
case sensitivity was a configurable parameter.  

>From its name you might expect it to be defined as (strcmp(a,b)==0),
which is done in some other programs.  However, rather surprisingly,
it is in fact equal to (StrCaseCmp(a,b) == 0).  

This seems like a bit of a trap:

 - People are likely to call it when they actually want a
   case-sensitive conversion.

 - Because of the way Unicode is supported, doing case-insensitive
   comparisons is much more expensive than a regular strcmp.  We may
   be paying this price when it's not needed.

It seems like a more consistent name would be strcaseequal_m().

I'm inclined to either rename it, or go through and check the callers.

Comments?

-- 
Martin 


More information about the samba-technical mailing list