From b57a636e4b4d23ba89c9d18118ed231500b0de06 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Sun, 16 Dec 2012 18:57:16 +0000 Subject: gdb/ 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, --- gdb/ChangeLog | 17 +++++++++++++++++ gdb/breakpoint.c | 6 ++---- gdb/dwarf2read.c | 8 +++----- gdb/psymtab.c | 9 +++------ gdb/symtab.c | 17 +++++++---------- gdb/symtab.h | 3 +-- 6 files changed, 33 insertions(+), 27 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9c24f95..0012638 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,20 @@ +2012-12-16 Jan Kratochvil + + 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 * Makefile.in (SFILES): Move ravenscar-thread.c from here... diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index cde6bf4..c2ce96c 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -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; } diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 4d5323e..beb2ea8 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -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, diff --git a/gdb/psymtab.c b/gdb/psymtab.c index d6dba3e..027ad38 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -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)) diff --git a/gdb/symtab.c b/gdb/symtab.c index 50ba92a..0fd75e5 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -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; diff --git a/gdb/symtab.h b/gdb/symtab.h index 6683cf5..ea39326 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -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, -- cgit v1.1