diff options
author | Eli Zaretskii <eliz@gnu.org> | 2001-05-06 06:07:20 +0000 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2001-05-06 06:07:20 +0000 |
commit | a7fdf62f9b557077e66b322619c584c5031b03a2 (patch) | |
tree | bbf0e1e85227d4c190d1dabac579f7723a9cc726 /gdb/symtab.c | |
parent | 644a1fe1ca256e8fa6a23276c25b0c7d3a687a0f (diff) | |
download | gdb-a7fdf62f9b557077e66b322619c584c5031b03a2.zip gdb-a7fdf62f9b557077e66b322619c584c5031b03a2.tar.gz gdb-a7fdf62f9b557077e66b322619c584c5031b03a2.tar.bz2 |
* symtab.c (lookup_symtab_1, lookup_partial_symtab): Use basename
instead of non-portable search for `/'. Use FILENAME_CMP instead
of STREQ, to account for case-insensitive filesystems.
(top-level): #include "filenames.h".
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r-- | gdb/symtab.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c index aecf362..8207eef 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -37,6 +37,7 @@ #include "demangle.h" #include "inferior.h" #include "linespec.h" +#include "filenames.h" /* for FILENAME_CMP */ #include "obstack.h" @@ -141,7 +142,6 @@ lookup_symtab_1 (char *name) { register struct symtab *s; register struct partial_symtab *ps; - register char *slash; register struct objfile *objfile; got_symtab: @@ -149,23 +149,15 @@ got_symtab: /* First, search for an exact match */ ALL_SYMTABS (objfile, s) - if (STREQ (name, s->filename)) - return s; - - slash = strchr (name, '/'); + if (FILENAME_CMP (name, s->filename) == 0) + return s; /* Now, search for a matching tail (only if name doesn't have any dirs) */ - if (!slash) + if (basename (name) == name) ALL_SYMTABS (objfile, s) { - char *p = s->filename; - char *tail = strrchr (p, '/'); - - if (tail) - p = tail + 1; - - if (STREQ (p, name)) + if (FILENAME_CMP (basename (s->filename), name) == 0) return s; } @@ -244,7 +236,7 @@ lookup_partial_symtab (char *name) ALL_PSYMTABS (objfile, pst) { - if (STREQ (name, pst->filename)) + if (FILENAME_CMP (name, pst->filename) == 0) { return (pst); } @@ -252,16 +244,10 @@ lookup_partial_symtab (char *name) /* Now, search for a matching tail (only if name doesn't have any dirs) */ - if (!strchr (name, '/')) + if (basename (name) == name) ALL_PSYMTABS (objfile, pst) { - char *p = pst->filename; - char *tail = strrchr (p, '/'); - - if (tail) - p = tail + 1; - - if (STREQ (p, name)) + if (FILENAME_CMP (basename (pst->filename), name) == 0) return (pst); } |