s/basename/lbasename/ clean up consequences of assuming lbasename()

returns const char *.
This commit is contained in:
Andrew Cagney 2001-06-13 18:30:07 +00:00
parent 2bc0a1288f
commit 31889e007b
3 changed files with 20 additions and 9 deletions

View File

@ -1,3 +1,14 @@
2001-06-11 Andrew Cagney <ac131313@redhat.com>
* symtab.c (lookup_symtab_1): Replace basename with lbasename.
(lookup_partial_symtab, file_matches): Ditto.
(make_source_files_completion_list): Ditto.
(make_file_symbol_completion_list): Ditto. Make local char*
variable ``tail'' constant.
(make_source_files_completion_list): Ditto with ``base_name''.
* source.c (open_source_file): Use lbasename. Make ``p'' const
char *.
2001-06-13 Eli Zaretskii <eliz@is.elta.co.il>
* config/i386/xm-go32.h (SLASH_P, ROOTED_P, SLASH_CHAR)

View File

@ -670,7 +670,7 @@ int
open_source_file (struct symtab *s)
{
char *path = source_path;
char *p;
const char *p;
int result;
char *fullname;
@ -710,7 +710,7 @@ open_source_file (struct symtab *s)
if (result < 0)
{
/* Didn't work. Try using just the basename. */
p = basename (s->filename);
p = lbasename (s->filename);
if (p != s->filename)
result = openp (path, 0, p, OPEN_MODE, 0, &s->fullname);
}

View File

@ -157,7 +157,7 @@ got_symtab:
if (lbasename (name) == name)
ALL_SYMTABS (objfile, s)
{
if (FILENAME_CMP (basename (s->filename), name) == 0)
if (FILENAME_CMP (lbasename (s->filename), name) == 0)
return s;
}
@ -247,7 +247,7 @@ lookup_partial_symtab (const char *name)
if (lbasename (name) == name)
ALL_PSYMTABS (objfile, pst)
{
if (FILENAME_CMP (basename (pst->filename), name) == 0)
if (FILENAME_CMP (lbasename (pst->filename), name) == 0)
return (pst);
}
@ -2276,7 +2276,7 @@ file_matches (char *file, char *files[], int nfiles)
{
for (i = 0; i < nfiles; i++)
{
if (strcmp (files[i], basename (file)) == 0)
if (strcmp (files[i], lbasename (file)) == 0)
return 1;
}
}
@ -3167,7 +3167,7 @@ make_file_symbol_completion_list (char *text, char *word, char *srcfile)
{
/* Maybe they typed the file with leading directories, while the
symbol tables record only its basename. */
char *tail = basename (srcfile);
const char *tail = lbasename (srcfile);
if (tail > srcfile)
s = lookup_symtab (tail);
@ -3272,7 +3272,7 @@ make_source_files_completion_list (char *text, char *word)
int list_used = 0;
size_t text_len = strlen (text);
char **list = (char **) xmalloc (list_alloced * sizeof (char *));
char *base_name;
const char *base_name;
list[0] = NULL;
@ -3302,7 +3302,7 @@ make_source_files_completion_list (char *text, char *word)
debug info records leading directories, but not the other
way around. This is what subroutines of breakpoint
command do when they parse file names. */
base_name = basename (s->filename);
base_name = lbasename (s->filename);
if (base_name != s->filename
&& !filename_seen (base_name, 1, &first)
#if HAVE_DOS_BASED_FILE_SYSTEM
@ -3338,7 +3338,7 @@ make_source_files_completion_list (char *text, char *word)
}
else
{
base_name = basename (ps->filename);
base_name = lbasename (ps->filename);
if (base_name != ps->filename
&& !filename_seen (base_name, 1, &first)
#if HAVE_DOS_BASED_FILE_SYSTEM