]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: Remove redundant parameter for filename completion
authorGuinevere Larsen <guinevere@redhat.com>
Tue, 22 Jul 2025 14:35:15 +0000 (11:35 -0300)
committerGuinevere Larsen <guinevere@redhat.com>
Tue, 22 Jul 2025 18:57:33 +0000 (15:57 -0300)
As I was working on an unrelated patch, I noticed that all calls to
make_source_files_completion_list had both parameters of the function
call being the same pointer.  I think we can remove that redundancy and
make that call with just one parameter.

Approved-By: Andrew Burgess <aburgess@redhat.com>
gdb/completer.c
gdb/symtab.c
gdb/symtab.h

index 0d68e76b6f4855f9120eb78ea52293df481216f0..deecbc209f7d2308edd86ae42589ac112e717365 100644 (file)
@@ -1008,7 +1008,7 @@ complete_files_symbols (completion_tracker &tracker,
         name, they cannot be asking for completion on files.  */
       if (strcspn (text, gdb_completer_file_name_break_characters)
          == text_len)
-       fn_list = make_source_files_completion_list (text, text);
+       fn_list = make_source_files_completion_list (text);
     }
 
   if (!fn_list.empty () && !tracker.have_completions ())
@@ -1059,7 +1059,7 @@ complete_source_filenames (const char *text)
      the user cannot be asking for completion on files.  */
   if (strcspn (text, gdb_completer_file_name_break_characters)
       == text_len)
-    return make_source_files_completion_list (text, text);
+    return make_source_files_completion_list (text);
 
   return {};
 }
@@ -1142,7 +1142,7 @@ collect_explicit_location_matches (completion_tracker &tracker,
        const char *source
          = string_or_empty (explicit_loc->source_filename.get ());
        completion_list matches
-         = make_source_files_completion_list (source, source);
+         = make_source_files_completion_list (source);
        tracker.add_completions (std::move (matches));
       }
       break;
index 7d1a0b066c7df6c39486e33ecf4bfa4b9f96fd28..160a465b676268ef12104ff41753a1175183e27f 100644 (file)
@@ -6402,7 +6402,7 @@ add_partial_filename_data::operator() (const char *filename,
    program.  */
 
 completion_list
-make_source_files_completion_list (const char *text, const char *word)
+make_source_files_completion_list (const char *text)
 {
   size_t text_len = strlen (text);
   completion_list list;
@@ -6428,7 +6428,7 @@ make_source_files_completion_list (const char *text, const char *word)
                {
                  /* This file matches for a completion; add it to the current
                     list of matches.  */
-                 add_filename_to_list (s->filename, text, word, &list);
+                 add_filename_to_list (s->filename, text, text, &list);
                }
              else
                {
@@ -6440,7 +6440,7 @@ make_source_files_completion_list (const char *text, const char *word)
                  if (base_name != s->filename
                      && !filenames_seen.seen (base_name)
                      && filename_ncmp (base_name, text, text_len) == 0)
-                   add_filename_to_list (base_name, text, word, &list);
+                   add_filename_to_list (base_name, text, text, &list);
                }
            }
        }
@@ -6448,7 +6448,7 @@ make_source_files_completion_list (const char *text, const char *word)
 
   datum.filename_seen_cache = &filenames_seen;
   datum.text = text;
-  datum.word = word;
+  datum.word = text;
   datum.text_len = text_len;
   datum.list = &list;
   map_symbol_filenames (datum, false /*need_fullname*/);
index 0a57be5ed80b6d7038d694a3143cb0b4cf0af1a0..a71195313a157f5ebe2890b531ef1aa70d1c39fd 100644 (file)
@@ -2482,8 +2482,7 @@ extern void collect_file_symbol_completion_matches
    symbol_name_match_type name_match_type,
    const char *, const char *, const char *);
 
-extern completion_list
-  make_source_files_completion_list (const char *, const char *);
+extern completion_list make_source_files_completion_list (const char *);
 
 /* Return whether SYM is a function/method, as opposed to a data symbol.  */