aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2010-01-13 08:48:26 +0000
committerTristan Gingold <gingold@adacore.com>2010-01-13 08:48:26 +0000
commit19172f39233dfb335d8d93a387918fe5f83c74f5 (patch)
tree89d47c7f2f919736ca84ceaa1dde04a93b28bd0e /bfd
parentb8dcd18250faa7438fc2c9051849f2ac03264ad9 (diff)
downloadgdb-19172f39233dfb335d8d93a387918fe5f83c74f5.zip
gdb-19172f39233dfb335d8d93a387918fe5f83c74f5.tar.gz
gdb-19172f39233dfb335d8d93a387918fe5f83c74f5.tar.bz2
2010-01-13 Tristan Gingold <gingold@adacore.com>
* archive.c (normalize): Use lbasename. (bfd_bsd_truncate_arname): Ditto. (bfd_gnu_truncate_arname): Ditto.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/archive.c55
2 files changed, 10 insertions, 53 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index fe66f42..8c397c3 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-13 Tristan Gingold <gingold@adacore.com>
+
+ * archive.c (normalize): Use lbasename.
+ (bfd_bsd_truncate_arname): Ditto.
+ (bfd_gnu_truncate_arname): Ditto.
+
2010-01-12 Tristan Gingold <gingold@adacore.com>
* makefile.vms (CFLAGS): Turns warnings into informational messages.
@@ -21,7 +27,7 @@
2010-01-11 Tristan Gingold <gingold@adacore.com>
- * archive.c (bfd_slurp_armap): Also check for Mach-O sorted armap.
+ * archive.c (bfd_slurp_armap): Also check for Mach-O sorted armap.
2010-01-11 Nick Clifton <nickc@redhat.com>
diff --git a/bfd/archive.c b/bfd/archive.c
index 321337e..2e1c8f0 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -1312,23 +1312,7 @@ normalize (bfd *abfd, const char *file)
static const char *
normalize (bfd *abfd ATTRIBUTE_UNUSED, const char *file)
{
- const char *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 != NULL)
- filename++;
- else
- filename = file;
- return filename;
+ return lbasename (file);
}
#endif
@@ -1820,25 +1804,9 @@ bfd_bsd_truncate_arname (bfd *abfd, const char *pathname, char *arhdr)
{
struct ar_hdr *hdr = (struct ar_hdr *) arhdr;
size_t length;
- const char *filename = strrchr (pathname, '/');
+ const char *filename = lbasename (pathname);
size_t maxlen = ar_maxnamelen (abfd);
-#ifdef HAVE_DOS_BASED_FILE_SYSTEM
- {
- /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
- char *bslash = strrchr (pathname, '\\');
- if (filename == NULL || (bslash != NULL && bslash > filename))
- filename = bslash;
- if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':')
- filename = pathname + 1;
- }
-#endif
-
- if (filename == NULL)
- filename = pathname;
- else
- ++filename;
-
length = strlen (filename);
if (length <= maxlen)
@@ -1868,26 +1836,9 @@ bfd_gnu_truncate_arname (bfd *abfd, const char *pathname, char *arhdr)
{
struct ar_hdr *hdr = (struct ar_hdr *) arhdr;
size_t length;
- const char *filename = strrchr (pathname, '/');
+ const char *filename = lbasename (pathname);
size_t maxlen = ar_maxnamelen (abfd);
-#ifdef HAVE_DOS_BASED_FILE_SYSTEM
- {
- /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
- char *bslash = strrchr (pathname, '\\');
-
- if (filename == NULL || (bslash != NULL && bslash > filename))
- filename = bslash;
- if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':')
- filename = pathname + 1;
- }
-#endif
-
- if (filename == NULL)
- filename = pathname;
- else
- ++filename;
-
length = strlen (filename);
if (length <= maxlen)