Re: ascii string comparison [Re: use C locale for LC_CTYPE]
Jorge Arellano Cid <[email protected]>
| Newsgroups | gmane.comp.web.dillo.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sun, Oct 23, 2011 at 10:28:43AM +0200, Johannes Hofmann wrote:
> On Sun, Oct 23, 2011 at 05:55:30AM +0000, corvid wrote:
> >
> > Here's an idea of what we'd get:
> >
> > http://www.dillo.org/test/ascii_strcasecmp.diff
> >
> > - The naming is clear but kind of ugly.
> > - I haven't added explanatory comments yet.
> > - For the moment, it just #defines dStr(n)casecmp to the
> > ASCII version because there are a bunch of them, but I'd
> > go through and change the calls.
> >
> > Thoughts?
>
> I think it's nasty, but the right way to fix this.
Yeah. Ater all locales/utf-8 is seldom a simple thing to handle right.
If we'd have to:
s/dStrcasecmp/dStrASCIIcasecmp/g
s/dStrncasecmp/dStrnASCIIcasecmp/g
then I'd keep the old function name and explain in the function's
comment why it is restricted to, or handled in the new way.
From a distance this global change looks to me like exposing ourselves
to more troubles. In other words, why not:
int dStrcasecmp(...)
{
if (locale has special rules)
special treatment
else
strcasecmp(...)
}
Disclaimer: I haven't studied the problem in detail.
--
Cheers
Jorge.-