interesting fact about StrCaseCmp
Martin Pool
mbp at samba.org
Tue Feb 18 00:35:32 GMT 2003
On 18 Feb 2003, Andrew Bartlett <abartlet at samba.org> wrote:
> Possibly only for long strings? But then that is probably
> micro-optimization.
If we really cared about optimizing this function, then we would
compare character-by-character rather than converting both strings to
uppercase first. This is a bit hard for some wierd encodings I know,
but it ought to be possible to do it in charcnv.c.
The case where we compare, for example, a thousand-character string to
the empty string is ridiculously slow at the moment.
I don't know if this is a problem for Samba overall or not, so I'm not
touching it at the moment.
int StrCaseCmp(const char *s, const char *t)
{
pstring buf1, buf2;
unix_strupper(s, strlen(s)+1, buf1, sizeof(buf1));
unix_strupper(t, strlen(t)+1, buf2, sizeof(buf2));
return strcmp(buf1,buf2);
}
--
Martin
More information about the samba-technical
mailing list