* [RFA] More file-name related fixes
@ 2001-05-02 10:26 Eli Zaretskii
2001-05-02 13:28 ` Kevin Buettner
2001-05-03 21:00 ` Elena Zannoni
0 siblings, 2 replies; 5+ messages in thread
From: Eli Zaretskii @ 2001-05-02 10:26 UTC (permalink / raw)
To: gdb-patches
(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. */
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [RFA] More file-name related fixes
2001-05-02 10:26 [RFA] More file-name related fixes Eli Zaretskii
@ 2001-05-02 13:28 ` Kevin Buettner
2001-05-02 14:08 ` Eli Zaretskii
2001-05-03 21:00 ` Elena Zannoni
1 sibling, 1 reply; 5+ messages in thread
From: Kevin Buettner @ 2001-05-02 13:28 UTC (permalink / raw)
To: Eli Zaretskii, gdb-patches
On May 2, 8:26pm, Eli Zaretskii wrote:
> +#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
> +
Is there any reason for leaving the code disabled by the #if 0
in place?
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [RFA] More file-name related fixes
2001-05-02 13:28 ` Kevin Buettner
@ 2001-05-02 14:08 ` Eli Zaretskii
0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2001-05-02 14:08 UTC (permalink / raw)
To: kevinb; +Cc: gdb-patches
> Date: Wed, 2 May 2001 13:28:16 -0700
> From: Kevin Buettner <kevinb@cygnus.com>
>
> On May 2, 8:26pm, Eli Zaretskii wrote:
>
> > +#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
> > +
>
> Is there any reason for leaving the code disabled by the #if 0
> in place?
As I wrote in a follow-up, this hunk should be disregarded. It
doesn't belong to this change (I was experimenting with something when
I ran Diff), and got into my message through my own negligence.
Sorry.
Thanks for reviewing the patch.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] More file-name related fixes
2001-05-02 10:26 [RFA] More file-name related fixes Eli Zaretskii
2001-05-02 13:28 ` Kevin Buettner
@ 2001-05-03 21:00 ` Elena Zannoni
2001-05-05 23:07 ` Eli Zaretskii
1 sibling, 1 reply; 5+ messages in thread
From: Elena Zannoni @ 2001-05-03 21:00 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
Eli Zaretskii writes:
> (Elena should love this, since it eradicates a few more STREQ's ;-)
Yes!
>
> I'm seeking approval for the following patches for symtab.c which make
> handling if file names in symtabs and psymtabs more portable:
>
Sure, it is much cleaner now.
(modulus tha extra diff)
Thanks
Elena
> 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. */
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [RFA] More file-name related fixes
2001-05-03 21:00 ` Elena Zannoni
@ 2001-05-05 23:07 ` Eli Zaretskii
0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2001-05-05 23:07 UTC (permalink / raw)
To: Elena Zannoni; +Cc: gdb-patches
On Fri, 4 May 2001, Elena Zannoni wrote:
> Eli Zaretskii writes:
> > (Elena should love this, since it eradicates a few more STREQ's ;-)
>
> Yes!
>
> >
> > I'm seeking approval for the following patches for symtab.c which make
> > handling if file names in symtabs and psymtabs more portable:
> >
>
> Sure, it is much cleaner now.
> (modulus tha extra diff)
Committed.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-05-05 23:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-02 10:26 [RFA] More file-name related fixes Eli Zaretskii
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox