* 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".
This commit is contained in:
Eli Zaretskii 2001-05-06 06:07:20 +00:00
parent 644a1fe1ca
commit a7fdf62f9b
2 changed files with 15 additions and 22 deletions

View File

@ -1,3 +1,10 @@
2001-05-06 Eli Zaretskii <eliz@is.elta.co.il>
* 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".
2001-05-05 Jim Blandy <jimb@redhat.com> 2001-05-05 Jim Blandy <jimb@redhat.com>
* breakpoint.c (check_duplicates): Use the breakpoint's type, not * breakpoint.c (check_duplicates): Use the breakpoint's type, not

View File

@ -37,6 +37,7 @@
#include "demangle.h" #include "demangle.h"
#include "inferior.h" #include "inferior.h"
#include "linespec.h" #include "linespec.h"
#include "filenames.h" /* for FILENAME_CMP */
#include "obstack.h" #include "obstack.h"
@ -141,7 +142,6 @@ lookup_symtab_1 (char *name)
{ {
register struct symtab *s; register struct symtab *s;
register struct partial_symtab *ps; register struct partial_symtab *ps;
register char *slash;
register struct objfile *objfile; register struct objfile *objfile;
got_symtab: got_symtab:
@ -149,23 +149,15 @@ got_symtab:
/* First, search for an exact match */ /* First, search for an exact match */
ALL_SYMTABS (objfile, s) ALL_SYMTABS (objfile, s)
if (STREQ (name, s->filename)) if (FILENAME_CMP (name, s->filename) == 0)
return s; return s;
slash = strchr (name, '/');
/* Now, search for a matching tail (only if name doesn't have any dirs) */ /* Now, search for a matching tail (only if name doesn't have any dirs) */
if (!slash) if (basename (name) == name)
ALL_SYMTABS (objfile, s) ALL_SYMTABS (objfile, s)
{ {
char *p = s->filename; if (FILENAME_CMP (basename (s->filename), name) == 0)
char *tail = strrchr (p, '/');
if (tail)
p = tail + 1;
if (STREQ (p, name))
return s; return s;
} }
@ -244,7 +236,7 @@ lookup_partial_symtab (char *name)
ALL_PSYMTABS (objfile, pst) ALL_PSYMTABS (objfile, pst)
{ {
if (STREQ (name, pst->filename)) if (FILENAME_CMP (name, pst->filename) == 0)
{ {
return (pst); 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) */ /* 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) ALL_PSYMTABS (objfile, pst)
{ {
char *p = pst->filename; if (FILENAME_CMP (basename (pst->filename), name) == 0)
char *tail = strrchr (p, '/');
if (tail)
p = tail + 1;
if (STREQ (p, name))
return (pst); return (pst);
} }