Code cleanup.
	* breakpoint.c (clear_command): Remove variable sal_name_len and its
	initialization, remove it from the compare_filenames_for_search call.
	* dwarf2read.c (dw2_map_symtabs_matching_filename): Remove variable
	name_len and its initialization, remove it from the
	compare_filenames_for_search calls.
	* psymtab.c (partial_map_symtabs_matching_filename): Likewise.
	* symtab.c (compare_filenames_for_search): Remove the search_len
	parameter, update the function comment, new variable search_len
	initialized from SEARCH_NAME.
	(iterate_over_some_symtabs): Remove variable name_len and its
	initialization, remove it from the compare_filenames_for_search calls.
	* symtab.h (compare_filenames_for_search): Remove the search_len
	parameter,
This commit is contained in:
Jan Kratochvil 2012-12-16 18:57:16 +00:00
parent 2344b8da6e
commit b57a636e4b
6 changed files with 33 additions and 27 deletions

View File

@ -1,3 +1,20 @@
2012-12-16 Jan Kratochvil <jan.kratochvil@redhat.com>
Code cleanup.
* breakpoint.c (clear_command): Remove variable sal_name_len and its
initialization, remove it from the compare_filenames_for_search call.
* dwarf2read.c (dw2_map_symtabs_matching_filename): Remove variable
name_len and its initialization, remove it from the
compare_filenames_for_search calls.
* psymtab.c (partial_map_symtabs_matching_filename): Likewise.
* symtab.c (compare_filenames_for_search): Remove the search_len
parameter, update the function comment, new variable search_len
initialized from SEARCH_NAME.
(iterate_over_some_symtabs): Remove variable name_len and its
initialization, remove it from the compare_filenames_for_search calls.
* symtab.h (compare_filenames_for_search): Remove the search_len
parameter,
2012-12-16 Joel Brobecker <brobecker@adacore.com>
* Makefile.in (SFILES): Move ravenscar-thread.c from here...

View File

@ -11881,7 +11881,7 @@ clear_command (char *arg, int from_tty)
make_cleanup (VEC_cleanup (breakpoint_p), &found);
for (i = 0; i < sals.nelts; i++)
{
int is_abs, sal_name_len;
int is_abs;
/* If exact pc given, clear bpts at that pc.
If line given (pc == 0), clear all bpts on specified line.
@ -11897,7 +11897,6 @@ clear_command (char *arg, int from_tty)
sal = sals.sals[i];
is_abs = sal.symtab == NULL ? 1 : IS_ABSOLUTE_PATH (sal.symtab->filename);
sal_name_len = is_abs ? 0 : strlen (sal.symtab->filename);
/* Find all matching breakpoints and add them to 'found'. */
ALL_BREAKPOINTS (b)
@ -11930,8 +11929,7 @@ clear_command (char *arg, int from_tty)
line_match = 1;
else if (!IS_ABSOLUTE_PATH (sal.symtab->filename)
&& compare_filenames_for_search (loc->source_file,
sal.symtab->filename,
sal_name_len))
sal.symtab->filename))
line_match = 1;
}

View File

@ -3068,7 +3068,6 @@ dw2_map_symtabs_matching_filename (struct objfile *objfile, const char *name,
{
int i;
const char *name_basename = lbasename (name);
int name_len = strlen (name);
int is_abs = IS_ABSOLUTE_PATH (name);
dw2_setup (objfile);
@ -3095,8 +3094,7 @@ dw2_map_symtabs_matching_filename (struct objfile *objfile, const char *name,
const char *this_name = file_data->file_names[j];
if (FILENAME_CMP (name, this_name) == 0
|| (!is_abs && compare_filenames_for_search (this_name,
name, name_len)))
|| (!is_abs && compare_filenames_for_search (this_name, name)))
{
if (dw2_map_expand_apply (objfile, per_cu,
name, full_path, real_path,
@ -3119,7 +3117,7 @@ dw2_map_symtabs_matching_filename (struct objfile *objfile, const char *name,
&& (FILENAME_CMP (full_path, this_real_name) == 0
|| (!is_abs
&& compare_filenames_for_search (this_real_name,
name, name_len))))
name))))
{
if (dw2_map_expand_apply (objfile, per_cu,
name, full_path, real_path,
@ -3137,7 +3135,7 @@ dw2_map_symtabs_matching_filename (struct objfile *objfile, const char *name,
&& (FILENAME_CMP (real_path, this_real_name) == 0
|| (!is_abs
&& compare_filenames_for_search (this_real_name,
name, name_len))))
name))))
{
if (dw2_map_expand_apply (objfile, per_cu,
name, full_path, real_path,

View File

@ -168,7 +168,6 @@ partial_map_symtabs_matching_filename (struct objfile *objfile,
{
struct partial_symtab *pst;
const char *name_basename = lbasename (name);
int name_len = strlen (name);
int is_abs = IS_ABSOLUTE_PATH (name);
ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, pst)
@ -183,8 +182,7 @@ partial_map_symtabs_matching_filename (struct objfile *objfile,
continue;
if (FILENAME_CMP (name, pst->filename) == 0
|| (!is_abs && compare_filenames_for_search (pst->filename,
name, name_len)))
|| (!is_abs && compare_filenames_for_search (pst->filename, name)))
{
if (partial_map_expand_apply (objfile, name, full_path, real_path,
pst, callback, data))
@ -205,7 +203,7 @@ partial_map_symtabs_matching_filename (struct objfile *objfile,
if (pst->fullname != NULL
&& (FILENAME_CMP (full_path, pst->fullname) == 0
|| (!is_abs && compare_filenames_for_search (pst->fullname,
name, name_len))))
name))))
{
if (partial_map_expand_apply (objfile, name, full_path, real_path,
pst, callback, data))
@ -224,8 +222,7 @@ partial_map_symtabs_matching_filename (struct objfile *objfile,
}
if (rp != NULL
&& (FILENAME_CMP (real_path, rp) == 0
|| (!is_abs && compare_filenames_for_search (real_path,
name, name_len))))
|| (!is_abs && compare_filenames_for_search (real_path, name))))
{
if (partial_map_expand_apply (objfile, name, full_path, real_path,
pst, callback, data))

View File

@ -147,15 +147,14 @@ const struct block *block_found;
/* See whether FILENAME matches SEARCH_NAME using the rule that we
advertise to the user. (The manual's description of linespecs
describes what we advertise). SEARCH_LEN is the length of
SEARCH_NAME. We assume that SEARCH_NAME is a relative path.
Returns true if they match, false otherwise. */
describes what we advertise). We assume that SEARCH_NAME is
a relative path. Returns true if they match, false otherwise. */
int
compare_filenames_for_search (const char *filename, const char *search_name,
int search_len)
compare_filenames_for_search (const char *filename, const char *search_name)
{
int len = strlen (filename);
size_t search_len = strlen (search_name);
if (len < search_len)
return 0;
@ -196,7 +195,6 @@ iterate_over_some_symtabs (const char *name,
{
struct symtab *s = NULL;
const char* base_name = lbasename (name);
int name_len = strlen (name);
int is_abs = IS_ABSOLUTE_PATH (name);
for (s = first; s != NULL && s != after_last; s = s->next)
@ -208,7 +206,7 @@ iterate_over_some_symtabs (const char *name,
return 1;
}
if (!is_abs && compare_filenames_for_search (s->filename, name, name_len))
if (!is_abs && compare_filenames_for_search (s->filename, name))
{
if (callback (s, data))
return 1;
@ -233,8 +231,7 @@ iterate_over_some_symtabs (const char *name,
return 1;
}
if (fp != NULL && !is_abs && compare_filenames_for_search (fp, name,
name_len))
if (fp != NULL && !is_abs && compare_filenames_for_search (fp, name))
{
if (callback (s, data))
return 1;
@ -256,7 +253,7 @@ iterate_over_some_symtabs (const char *name,
return 1;
}
if (!is_abs && compare_filenames_for_search (rp, name, name_len))
if (!is_abs && compare_filenames_for_search (rp, name))
{
if (callback (s, data))
return 1;

View File

@ -1309,8 +1309,7 @@ extern int symtab_create_debug;
extern int basenames_may_differ;
int compare_filenames_for_search (const char *filename,
const char *search_name,
int search_len);
const char *search_name);
int iterate_over_some_symtabs (const char *name,
const char *full_path,