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

Ian Lance Taylor
2007-04-11T20:33:50Z

Eli Zaretskii <eliz@gnu.org> writes:

> > Date: Wed, 11 Apr 2007 09:26:15 +0200
> > From: Joel Brobecker <brobecker@adacore.com>
> > Cc: Daniel Jacobowitz <drow@false.org>, gcc-patches@gcc.gnu.org,
> > gdb-patches@sourceware.org
> >
> > > 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.
>
> That's one way, but, as you point out, it has drawbacks. So my advice
> would be to compare individual characters so that A-Za-z compare
> case-insensitively. A simple macro or inline function should be able
> to do this. For example, if you mask the 5th bit, upper-case and
> lower-case ASCII will be the same.

For locale-independent case conversion, use TOLOWER or TOUPPER in
include/safe-ctype.h.

Ian