diff --git a/gdb/symtab.c b/gdb/symtab.c
index 79e43eafde18..10a794004d33 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -4899,7 +4899,7 @@ global_symbol_searcher::add_matching_symbols
 	(objfile *objfile,
 	 const std::optional<compiled_regex> &name_regex,
 	 const std::optional<compiled_regex> &type_regex,
-	 std::set<symbol_search> *result_set) const
+	 std::set<symbol_search> &result_set) const
 {
   /* Add matching symbols (if not already present).  */
   for (compunit_symtab &cust : objfile->compunits ())
@@ -4918,8 +4918,8 @@ global_symbol_searcher::add_matching_symbols
 		continue;
 
 	      /* Match, insert if not already in the results.  */
-	      if (result_set->size () < m_max_search_results)
-		result_set->emplace (block, sym);
+	      if (result_set.size () < m_max_search_results)
+		result_set.emplace (block, sym);
 	      else
 		return false;
 	    }
@@ -4934,7 +4934,7 @@ global_symbol_searcher::add_matching_symbols
 bool
 global_symbol_searcher::add_matching_msymbols
 	(objfile *objfile, const std::optional<compiled_regex> &name_regex,
-	 std::vector<symbol_search> *results) const
+	 std::vector<symbol_search> &results) const
 {
   for (minimal_symbol *msymbol : objfile->msymbols ())
     {
@@ -4955,8 +4955,8 @@ global_symbol_searcher::add_matching_msymbols
 	continue;
 
       /* Matching msymbol, add it to the results list.  */
-      if (results->size () < m_max_search_results)
-	results->emplace_back (GLOBAL_BLOCK, msymbol, objfile);
+      if (results.size () < m_max_search_results)
+	results.emplace_back (GLOBAL_BLOCK, msymbol, objfile);
       else
 	return false;
     }
@@ -5056,8 +5056,7 @@ global_symbol_searcher::search () const
 	 RESULT_SET set.  Use a set here so that we can easily detect
 	 duplicates as we go, and can therefore track how many unique
 	 matches we have found so far.  */
-      if (!add_matching_symbols (&objfile, name_regex, type_regex,
-				 &result_set))
+      if (!add_matching_symbols (&objfile, name_regex, type_regex, result_set))
 	break;
     }
 
@@ -5077,7 +5076,7 @@ global_symbol_searcher::search () const
       gdb_assert (m_kind == symbol_search_kind::VARIABLE
 		  || m_kind == symbol_search_kind::FUNCTION);
       for (objfile &objfile : current_program_space->objfiles ())
-	if (!add_matching_msymbols (&objfile, name_regex, &result))
+	if (!add_matching_msymbols (&objfile, name_regex, result))
 	  break;
     }
 
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 5dd0475e4491..e382b64b427c 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2705,7 +2705,7 @@ class global_symbol_searcher
   bool add_matching_symbols (objfile *objfile,
 			     const std::optional<compiled_regex> &name_regex,
 			     const std::optional<compiled_regex> &type_regex,
-			     std::set<symbol_search> *result_set) const;
+			     std::set<symbol_search> &result_set) const;
 
   /* Add msymbols from OBJFILE that match NAME_REGEX and M_KIND, to the
      results vector RESULTS.  Return false if we stop adding results early
@@ -2715,7 +2715,7 @@ class global_symbol_searcher
      didn't _not_ add a result due to reaching MAX_SEARCH_RESULTS.  */
   bool add_matching_msymbols (objfile *objfile,
 			      const std::optional<compiled_regex> &name_regex,
-			      std::vector<symbol_search> *results) const;
+			      std::vector<symbol_search> &results) const;
 
   /* Return true if MSYMBOL is of type M_KIND.  */
   bool is_suitable_msymbol (const minimal_symbol *msymbol) const;
