clean up strequal()?

Andrew Bartlett abartlet at samba.org
Wed Apr 9 06:16:24 GMT 2003


On Wed, Apr 09, 2003 at 03:30:36PM +1000, Martin Pool wrote:
> 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.  

It still is...

> >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.

Actually, I thought it was for case-insensitive!
(ie, an interface for strcasecmp() that returned a nice BOOL)

>  - 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.

Many of the callers are for config file paramaters that could (should?) be
made case sensitive.

Andrew Bartlett


More information about the samba-technical mailing list