gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 16 Dec 2012 18:57:16 +0000 (18:57 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 16 Dec 2012 18:57:16 +0000 (18:57 +0000)
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
gdb/breakpoint.c
gdb/dwarf2read.c
gdb/psymtab.c
gdb/symtab.c
gdb/symtab.h

index 9c24f958d49a8a95c68fae244defe1b4ead32e86..001263818ea7d43272e122e7f2c17fa5777a8a39 100644 (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...
index cde6bf497d3728dee11f83e92349d13aba9477d1..c2ce96c9188ba5000977573e0b35ffd9a308af34 100644 (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;
                    }
 
index 4d5323e9b869c423778d8314e758b4128f2893d4..beb2ea8ecd82a53b75f950c098a8d4fc0f8bb76f 100644 (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,
index d6dba3e134f54c6bb8c47aa8e0eda38da119f16b..027ad38b8b0f559de6421e1e6db52e1aba052278 100644 (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))
index 50ba92a44fd700da0c7e37f631584e7c6f1e7a59..0fd75e53c86ff6a82f550392345668d278e224bd 100644 (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;
index 6683cf5886df509b8f2b153b0fc0e899f8302f65..ea393261499c405a88bda34de4aa71df1d08e448 100644 (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,
This page took 0.044337 seconds and 4 git commands to generate.