+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>
* breakpoint.c (check_duplicates): Use the breakpoint's type, not
#include "demangle.h"
#include "inferior.h"
#include "linespec.h"
+#include "filenames.h" /* for FILENAME_CMP */
#include "obstack.h"
{
register struct symtab *s;
register struct partial_symtab *ps;
- register char *slash;
register struct objfile *objfile;
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;
}
ALL_PSYMTABS (objfile, pst)
{
- if (STREQ (name, pst->filename))
+ if (FILENAME_CMP (name, pst->filename) == 0)
{
return (pst);
}
/* 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);
}