Re: [RFA/libiberty] Fix documentation issues in filename_cmp.c

Joel Brobecker
2007-04-11T07:24:35Z

> > 2. Glibc's strcasecmp uses tolower and honors LC_COLLATE.
>
> But the version in libiberty only handles ASCII.
>
> > Which behavior do we want here, anyway? I'm not sure...
>
> I think we should fold only ASCII characters, since it's consistent
> with libiberty's strcasecmp.

If we follow your recommendation, I think the best approach is to
use strcasecmp after having changed forward slashes into backward
slashes like I did in my first implementation. That way, we let
strcasecmp deal with the folding.

The downside is that we now end up having to allocate some memory
to hold a copy of the two filenames (in order to do the fixup on
slashes above), whereas we don't need that right now. This is something
that will be needed eventually if someone wants to enhance it to
handle multiple slashes, etc. So adding the couple of string copies
now isn't so bad.

--
Joel