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

Eli Zaretskii eliz@gnu.org
Wed Mar 9 07:12:00 GMT 2011


> From: Pedro Alves <pedro@codesourcery.com>
> Date: Tue, 8 Mar 2011 22:37:59 +0000
> Cc: DJ Delorie <dj@redhat.com>,
>  Eli Zaretskii <eliz@gnu.org>,
>  ktietz70@googlemail.com,
>  binutils@sourceware.org,
>  gcc-patches@gcc.gnu.org
> 
> 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).

It would be reasonable to rewrite filename_dirrchr in terms of
lbasename, though, by backing up the pointer returned by lbasename if
it points to a slash, and otherwise returning NULL.  The case of
"d:foo" should also be resolved (probably, return a pointer to the
colon).



More information about the Gdb-patches mailing list