Re: [patch libiberty include]: Add additional helper functions for directory-separator searching

Eli Zaretskii
2011-03-09T12:35:14Z

> From: Pedro Alves <pedro@codesourcery.com>
> Date: Wed, 9 Mar 2011 11:46:36 +0000
> Cc: gdb-patches@sourceware.org,
> dj@redhat.com,
> ktietz70@googlemail.com,
> binutils@sourceware.org,
> gcc-patches@gcc.gnu.org
>
> On Wednesday 09 March 2011 05:29:09, Eli Zaretskii wrote:
> > > Actually, is there any case where lbasename wouldn't
> > > work instead of filename_dirrchr?
> >
> > Almost: lbasename returns a pointer one character after the last
> > slash. It also skips the drive letter on DOS/Windows (which might be
> > TRT, actually).
>
> I meant a valid use case in the code bases.

Sorry for my misunderstanding.

> Might as well cook up a (gdb) patch. Find it pasted below. Does it
> look good to you?

Yes, looks fine. Thanks.

> The one's left are: 1 in a linux-native only file (never cares
> for other filesystem semantics), and a couple in the coff and
> mdebug readers. The latter could be rewritten in terms of
> lbasename, but I'm not sure whether gcc outputs a literal '/' in
> that case even when building on mingw. If so, and we changed them,
> we'd be breaking reading these files on Windows

Sorry, I don't understand how would that break on Windows. Could you
elaborate? And what "couple of coff and mdebug readers" did you have
in mind?