This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [Patch] bfd/archive.c: uses lbasename
On Jan 13, 2010, at 1:41 AM, Alan Modra wrote:
> On Tue, Jan 12, 2010 at 11:51:40AM +0100, Tristan Gingold wrote:
>> * archive.c (normalize): Use lbasename.
>> (bfd_bsd_truncate_arname): Ditto.
>> (bfd_gnu_truncate_arname): Ditto.
>
> OK. lbasename wasn't in libiberty when this code was added to
> archive.c.
Sure. Thanks for the review. I committed the patch.
There are also two instances of such cleanup in binutils/ See patch below.
Tristan.
binutils/
2010-01-13 Tristan Gingold <gingold@adacore.com>
* ar.c (main): Use lbasename.
(normalize): Ditto.
* objdump.c (update_source_path): Ditto.
Index: ar.c
===================================================================
RCS file: /cvs/src/src/binutils/ar.c,v
retrieving revision 1.63
diff -c -r1.63 ar.c
*** ar.c 8 Jan 2010 11:14:29 -0000 1.63
--- ar.c 13 Jan 2010 09:03:23 -0000
***************
*** 303,324 ****
if (full_pathname)
return file;
! filename = strrchr (file, '/');
! #ifdef HAVE_DOS_BASED_FILE_SYSTEM
! {
! /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
! char *bslash = strrchr (file, '\\');
!
! if (filename == NULL || (bslash != NULL && bslash > filename))
! filename = bslash;
! if (filename == NULL && file[0] != '\0' && file[1] == ':')
! filename = file + 1;
! }
! #endif
! if (filename != (char *) NULL)
! filename++;
! else
! filename = file;
if (ar_truncate
&& abfd != NULL
--- 303,309 ----
if (full_pathname)
return file;
! filename = lbasename (file);
if (ar_truncate
&& abfd != NULL
***************
*** 397,420 ****
if (is_ranlib < 0)
{
! char *temp;
!
! temp = strrchr (program_name, '/');
! #ifdef HAVE_DOS_BASED_FILE_SYSTEM
! {
! /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
! char *bslash = strrchr (program_name, '\\');
- if (temp == NULL || (bslash != NULL && bslash > temp))
- temp = bslash;
- if (temp == NULL && program_name[0] != '\0' && program_name[1] == ':')
- temp = program_name + 1;
- }
- #endif
- if (temp == NULL)
- temp = program_name;
- else
- ++temp;
if (strlen (temp) >= 6
&& FILENAME_CMP (temp + strlen (temp) - 6, "ranlib") == 0)
is_ranlib = 1;
--- 382,389 ----
if (is_ranlib < 0)
{
! const char *temp = lbasename (program_name);
if (strlen (temp) >= 6
&& FILENAME_CMP (temp + strlen (temp) - 6, "ranlib") == 0)
is_ranlib = 1;
Index: objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.168
diff -c -r1.168 objdump.c
*** objdump.c 11 Dec 2009 13:42:06 -0000 1.168
--- objdump.c 13 Jan 2010 09:03:24 -0000
***************
*** 1156,1176 ****
return NULL;
/* Get the name of the file. */
! fname = strrchr (filename, '/');
! #ifdef HAVE_DOS_BASED_FILE_SYSTEM
! {
! /* We could have a mixed forward/back slash case. */
! char *backslash = strrchr (filename, '\\');
! if (fname == NULL || (backslash != NULL && backslash > fname))
! fname = backslash;
! if (fname == NULL && filename[0] != '\0' && filename[1] == ':')
! fname = filename + 1;
! }
! #endif
! if (fname == NULL)
! fname = filename;
! else
! ++fname;
/* If file exists under a new path, we need to add it to the list
so that show_line knows about it. */
--- 1156,1162 ----
return NULL;
/* Get the name of the file. */
! fname = lbasename (filename);
/* If file exists under a new path, we need to add it to the list
so that show_line knows about it. */