From: "Eli Zaretskii" <eliz@is.elta.co.il>
To: gdb-patches@sources.redhat.com
Subject: [RFA] More file-name related fixes
Date: Wed, 02 May 2001 10:26:00 -0000 [thread overview]
Message-ID: <3791-Wed02May2001202656+0300-eliz@is.elta.co.il> (raw)
(Elena should love this, since it eradicates a few more STREQ's ;-)
I'm seeking approval for the following patches for symtab.c which make
handling if file names in symtabs and psymtabs more portable:
2001-05-02 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".
--- gdb/symtab.c~3 Sat Apr 28 23:18:44 2001
+++ gdb/symtab.c Wed May 2 13:42:22 2001
@@ -36,6 +36,7 @@
#include "demangle.h"
#include "inferior.h"
#include "linespec.h"
+#include "filenames.h" /* for FILENAME_CMP */
#include "obstack.h"
@@ -139,7 +140,6 @@ lookup_symtab_1 (char *name)
{
register struct symtab *s;
register struct partial_symtab *ps;
- register char *slash;
register struct objfile *objfile;
got_symtab:
@@ -147,23 +147,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;
}
@@ -242,7 +234,7 @@ lookup_partial_symtab (char *name)
ALL_PSYMTABS (objfile, pst)
{
- if (STREQ (name, pst->filename))
+ if (FILENAME_CMP (name, pst->filename) == 0)
{
return (pst);
}
@@ -250,16 +242,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);
}
@@ -3085,6 +3071,8 @@ make_symbol_completion_list (char *text,
return (return_val);
}
+#if 0
+
static struct sym_and_file {
char *sym;
char *file;
@@ -3352,6 +3340,8 @@ make_file_symbol_completion_list (char *
return (return_val);
}
+#endif
+
/* A helper function for make_source_files_completion_list. It adds
another file name to a list of possible completions, growing the
list as necessary. */
next reply other threads:[~2001-05-02 10:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-02 10:26 Eli Zaretskii [this message]
2001-05-02 13:28 ` Kevin Buettner
2001-05-02 14:08 ` Eli Zaretskii
2001-05-03 21:00 ` Elena Zannoni
2001-05-05 23:07 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3791-Wed02May2001202656+0300-eliz@is.elta.co.il \
--to=eliz@is.elta.co.il \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox