This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 18/18] Remove the vector return result from the completion API.


This patch completes the redesign of the completion and completion-
limiting API.  Since the completer's internal data is now responsible
for tracking all completions and the result of the completion operation
no longer uses vectors (except for the final list given to readline),
we can remove the vectors from the API entirely.

gdb/ChangeLog

	* command.h (completer_ftype): Change return type from
	VEC (char_ptr) * to void.  Update all users of this definition.
	* completer.h (maybe_add_completion): Update explanation of usage.
	* symtab.c (free_completion_list): Remove.
	(do_free_completion_list): Remove.
	(return_val): Remove global.
---
 gdb/ada-lang.c            |   26 +++-----
 gdb/break-catch-syscall.c |    8 +-
 gdb/breakpoint.c          |   19 ++----
 gdb/cli/cli-decode.c      |   34 ++++------
 gdb/command.h             |   18 +++--
 gdb/completer.c           |  154 ++++++++++++++++-----------------------------
 gdb/completer.h           |   50 +++++++--------
 gdb/corefile.c            |    4 +
 gdb/cp-abi.c              |    4 +
 gdb/f-lang.c              |    6 +-
 gdb/guile/scm-cmd.c       |   29 ++------
 gdb/infrun.c              |   12 +---
 gdb/interps.c             |   11 +--
 gdb/language.h            |    2 -
 gdb/python/py-cmd.c       |   10 +--
 gdb/symtab.c              |  103 +++++++-----------------------
 gdb/symtab.h              |   15 ++--
 gdb/value.c               |   11 +--
 gdb/value.h               |    4 +
 19 files changed, 184 insertions(+), 336 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 4b9b3d3..077ccf1 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -6123,8 +6123,7 @@ symbol_completion_match (const char *sym_name,
    encoded).  */
 
 static enum maybe_add_completion_enum
-symbol_completion_add (VEC(char_ptr) **sv,
-		       struct completer_data *cdata,
+symbol_completion_add (struct completer_data *cdata,
                        const char *sym_name,
                        const char *text, int text_len,
                        const char *orig_text, const char *word,
@@ -6166,7 +6165,6 @@ symbol_completion_add (VEC(char_ptr) **sv,
     {
     case MAYBE_ADD_COMPLETION_OK:
     case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-      VEC_safe_push (char_ptr, *sv, completion);
       break;
     case MAYBE_ADD_COMPLETION_MAX_REACHED:
     case MAYBE_ADD_COMPLETION_DUPLICATE:
@@ -6180,7 +6178,6 @@ symbol_completion_add (VEC(char_ptr) **sv,
    expand_symtabs_matching method.  */
 struct add_partial_datum
 {
-  VEC(char_ptr) **completions;
   const char *text;
   int text_len;
   const char *text0;
@@ -6203,7 +6200,7 @@ ada_complete_symbol_matcher (const char *name, void *user_data)
 /* Return a list of possible symbol names completing TEXT0.  WORD is
    the entire command on which completion is made.  */
 
-static VEC (char_ptr) *
+static void
 ada_make_symbol_completion_list (struct completer_data *cdata,
 				 const char *text0, const char *word,
 				 enum type_code code)
@@ -6212,7 +6209,6 @@ ada_make_symbol_completion_list (struct completer_data *cdata,
   int text_len;
   int wild_match_p;
   int encoded_p;
-  VEC(char_ptr) *completions = VEC_alloc (char_ptr, 128);
   struct symbol *sym;
   struct compunit_symtab *s;
   struct minimal_symbol *msymbol;
@@ -6253,7 +6249,6 @@ ada_make_symbol_completion_list (struct completer_data *cdata,
   {
     struct add_partial_datum data;
 
-    data.completions = &completions;
     data.text = text;
     data.text_len = text_len;
     data.text0 = text0;
@@ -6272,7 +6267,7 @@ ada_make_symbol_completion_list (struct completer_data *cdata,
   ALL_MSYMBOLS (objfile, msymbol)
   {
     QUIT;
-    add_status = symbol_completion_add (&completions, cdata,
+    add_status = symbol_completion_add (cdata,
 					MSYMBOL_LINKAGE_NAME (msymbol),
 					text, text_len, text0, word,
 					wild_match_p, encoded_p);
@@ -6283,7 +6278,7 @@ ada_make_symbol_completion_list (struct completer_data *cdata,
       case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
       case MAYBE_ADD_COMPLETION_MAX_REACHED:
 	do_cleanups (old_chain);
-	return completions;
+	return;
       case MAYBE_ADD_COMPLETION_DUPLICATE:
 	break;
       }
@@ -6299,7 +6294,7 @@ ada_make_symbol_completion_list (struct completer_data *cdata,
 
       ALL_BLOCK_SYMBOLS (b, iter, sym)
       {
-        add_status = symbol_completion_add (&completions, cdata,
+        add_status = symbol_completion_add (cdata,
 					    SYMBOL_LINKAGE_NAME (sym),
 					    text, text_len, text0, word,
 					    wild_match_p, encoded_p);
@@ -6310,7 +6305,7 @@ ada_make_symbol_completion_list (struct completer_data *cdata,
 	  case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
 	  case MAYBE_ADD_COMPLETION_MAX_REACHED:
 	    do_cleanups (old_chain);
-	    return completions;
+	    return;
 	  case MAYBE_ADD_COMPLETION_DUPLICATE:
 	    break;
 	  }
@@ -6326,7 +6321,7 @@ ada_make_symbol_completion_list (struct completer_data *cdata,
     b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (s), GLOBAL_BLOCK);
     ALL_BLOCK_SYMBOLS (b, iter, sym)
     {
-      add_status = symbol_completion_add (&completions, cdata,
+      add_status = symbol_completion_add (cdata,
 					  SYMBOL_LINKAGE_NAME (sym),
 					  text, text_len, text0, word,
 					  wild_match_p, encoded_p);
@@ -6337,7 +6332,7 @@ ada_make_symbol_completion_list (struct completer_data *cdata,
 	case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
 	case MAYBE_ADD_COMPLETION_MAX_REACHED:
 	  do_cleanups (old_chain);
-	  return completions;
+	  return;
 	case MAYBE_ADD_COMPLETION_DUPLICATE:
 	  break;
 	}
@@ -6353,7 +6348,7 @@ ada_make_symbol_completion_list (struct completer_data *cdata,
       continue;
     ALL_BLOCK_SYMBOLS (b, iter, sym)
     {
-      add_status = symbol_completion_add (&completions, cdata,
+      add_status = symbol_completion_add (cdata,
 					 SYMBOL_LINKAGE_NAME (sym),
 					 text, text_len, text0, word,
 					 wild_match_p, encoded_p);
@@ -6364,7 +6359,7 @@ ada_make_symbol_completion_list (struct completer_data *cdata,
 	case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
 	case MAYBE_ADD_COMPLETION_MAX_REACHED:
 	  do_cleanups (old_chain);
-	  return completions;
+	  return;
 	case MAYBE_ADD_COMPLETION_DUPLICATE:
 	  break;
 	}
@@ -6372,7 +6367,6 @@ ada_make_symbol_completion_list (struct completer_data *cdata,
   }
 
   do_cleanups (old_chain);
-  return completions;
 }
 
                                 /* Field Access */
diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c
index 4677132..a542826 100644
--- a/gdb/break-catch-syscall.c
+++ b/gdb/break-catch-syscall.c
@@ -591,17 +591,17 @@ catching_syscall_number (int syscall_number)
 }
 
 /* Complete syscall names.  Used by "catch syscall".  */
-static VEC (char_ptr) *
+static void
 catch_syscall_completer (struct completer_data *cdata,
 			 struct cmd_list_element *cmd,
                          const char *text, const char *word)
 {
   const char **list = get_syscall_names (get_current_arch ());
-  VEC (char_ptr) *retlist
-    = (list == NULL) ? NULL : complete_on_enum (cdata, list, word, word);
+
+  if (list != NULL)
+    complete_on_enum (cdata, list, word, word);
 
   xfree (list);
-  return retlist;
 }
 
 static void
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 04dc734..894e779 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1032,7 +1032,7 @@ set_breakpoint_condition (struct breakpoint *b, const char *exp,
 
 /* Completion for the "condition" command.  */
 
-static VEC (char_ptr) *
+static void
 condition_completer (struct completer_data *cdata,
 		     struct cmd_list_element *cmd,
 		     const char *text, const char *word)
@@ -1045,14 +1045,13 @@ condition_completer (struct completer_data *cdata,
     {
       int len;
       struct breakpoint *b;
-      VEC (char_ptr) *result = NULL;
 
       if (text[0] == '$')
 	{
 	  /* We don't support completion of history indices.  */
-	  if (isdigit (text[1]))
-	    return NULL;
-	  return complete_internalvar (cdata, &text[1]);
+	  if (!isdigit (text[1]))
+	    complete_internalvar (cdata, &text[1]);
+	  return;
 	}
 
       /* We're completing the breakpoint number.  */
@@ -1073,14 +1072,12 @@ condition_completer (struct completer_data *cdata,
 	      switch (add_status)
 		{
 		case MAYBE_ADD_COMPLETION_OK:
-		  VEC_safe_push (char_ptr, result, completion);
 		  break;
 		case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-		  VEC_safe_push (char_ptr, result, completion);
-		  return result;
+		  return;
 		case MAYBE_ADD_COMPLETION_MAX_REACHED:
 		  xfree (completion);
-		  return result;
+		  return;
 		case MAYBE_ADD_COMPLETION_DUPLICATE:
 		  xfree (completion);
 		  break;
@@ -1088,12 +1085,12 @@ condition_completer (struct completer_data *cdata,
 	    }
 	}
 
-      return result;
+      return;
     }
 
   /* We're completing the expression part.  */
   text = skip_spaces_const (space);
-  return expression_completer (cdata, cmd, text, word);
+  expression_completer (cdata, cmd, text, word);
 }
 
 /* condition N EXP -- set break condition of breakpoint N to EXP.  */
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 4e0fbf7..3c205c1 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -647,7 +647,7 @@ add_setshow_optional_filename_cmd (const char *name, enum command_class theclass
 /* Completes on literal "unlimited".  Used by integer commands that
    support a special "unlimited" value.  */
 
-static VEC (char_ptr) *
+static void
 integer_unlimited_completer (struct completer_data *cdata,
 			     struct cmd_list_element *ignore,
 			     const char *text, const char *word)
@@ -658,7 +658,7 @@ integer_unlimited_completer (struct completer_data *cdata,
       NULL,
     };
 
-  return complete_on_enum (cdata, keywords, text, word);
+  complete_on_enum (cdata, keywords, text, word);
 }
 
 /* Add element named NAME to both the set and show command LISTs (the
@@ -1757,22 +1757,21 @@ lookup_cmd_composition (const char *text,
 
 /* Helper function for SYMBOL_COMPLETION_FUNCTION.  */
 
-/* Return a vector of char pointers which point to the different
-   possible completions in LIST of TEXT.
+/* Add completions to CDATA for the different possible completions
+   in LIST of TEXT.
 
    WORD points in the same buffer as TEXT, and completions should be
    returned relative to this position.  For example, suppose TEXT is
    "foo" and we want to complete to "foobar".  If WORD is "oo", return
    "oobar"; if WORD is "baz/foo", return "baz/foobar".  */
 
-VEC (char_ptr) *
+void
 complete_on_cmdlist (struct completer_data *cdata,
 		     struct cmd_list_element *list,
 		     const char *text, const char *word,
 		     int ignore_help_classes)
 {
   struct cmd_list_element *ptr;
-  VEC (char_ptr) *matchlist = NULL;
   int textlen = strlen (text);
   int pass;
   int saw_deprecated_match = 0;
@@ -1820,14 +1819,12 @@ complete_on_cmdlist (struct completer_data *cdata,
 	    switch (add_status)
 	      {
 	      case MAYBE_ADD_COMPLETION_OK:
-		VEC_safe_push (char_ptr, matchlist, match);
 		break;
 	      case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-		VEC_safe_push (char_ptr, matchlist, match);
-		return matchlist;
+		return;
 	      case MAYBE_ADD_COMPLETION_MAX_REACHED:
 		xfree (match);
-		return matchlist;
+		return;
 	      case MAYBE_ADD_COMPLETION_DUPLICATE:
 		xfree (match);
 		break;
@@ -1838,26 +1835,23 @@ complete_on_cmdlist (struct completer_data *cdata,
       if (!saw_deprecated_match)
 	break;
     }
-
-  return matchlist;
 }
 
 /* Helper function for SYMBOL_COMPLETION_FUNCTION.  */
 
-/* Return a vector of char pointers which point to the different
-   possible completions in CMD of TEXT.
+/* Add completions to CDATA for the different possible completions in
+   CMD of TEXT.
 
    WORD points in the same buffer as TEXT, and completions should be
    returned relative to this position.  For example, suppose TEXT is "foo"
    and we want to complete to "foobar".  If WORD is "oo", return
    "oobar"; if WORD is "baz/foo", return "baz/foobar".  */
 
-VEC (char_ptr) *
+void
 complete_on_enum (struct completer_data *cdata,
 		  const char *const *enumlist,
 		  const char *text, const char *word)
 {
-  VEC (char_ptr) *matchlist = NULL;
   int textlen = strlen (text);
   int i;
   const char *name;
@@ -1888,21 +1882,17 @@ complete_on_enum (struct completer_data *cdata,
 	switch (add_status)
 	  {
 	  case MAYBE_ADD_COMPLETION_OK:
-	    VEC_safe_push (char_ptr, matchlist, match);
 	    break;
 	  case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-	    VEC_safe_push (char_ptr, matchlist, match);
-	    return matchlist;
+	    return;
 	  case MAYBE_ADD_COMPLETION_MAX_REACHED:
 	    xfree (match);
-	    return matchlist;
+	    return;
 	  case MAYBE_ADD_COMPLETION_DUPLICATE:
 	    xfree (match);
 	    break;
 	  }
       }
-
-  return matchlist;
 }
 
 
diff --git a/gdb/command.h b/gdb/command.h
index b2aeb30..82872c0 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -158,9 +158,9 @@ typedef void cmd_sfunc_ftype (char *args, int from_tty,
 extern void set_cmd_sfunc (struct cmd_list_element *cmd,
 			   cmd_sfunc_ftype *sfunc);
 
-typedef VEC (char_ptr) *completer_ftype (struct completer_data *,
-					 struct cmd_list_element *,
-					 const char *, const char *);
+typedef void completer_ftype (struct completer_data *,
+			      struct cmd_list_element *,
+			      const char *, const char *);
 
 typedef void completer_ftype_void (struct cmd_list_element *,
 				   const char *, const char *);
@@ -228,13 +228,13 @@ extern struct cmd_list_element *add_info (const char *,
 extern struct cmd_list_element *add_info_alias (const char *, const char *,
 						int);
 
-extern VEC (char_ptr) *complete_on_cmdlist (struct completer_data *,
-					    struct cmd_list_element *,
-					    const char *, const char *, int);
+extern void complete_on_cmdlist (struct completer_data *,
+				 struct cmd_list_element *,
+				 const char *, const char *, int);
 
-extern VEC (char_ptr) *complete_on_enum (struct completer_data *,
-					 const char *const *enumlist,
-					 const char *, const char *);
+extern void complete_on_enum (struct completer_data *,
+			      const char *const *enumlist,
+			      const char *, const char *);
 
 /* Functions that implement commands about CLI commands.  */
 
diff --git a/gdb/completer.c b/gdb/completer.c
index 425b5aa..d29df1a 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -122,22 +122,23 @@ readline_line_completion_function (const char *text, int matches)
 
 /* This can be used for functions which don't want to complete on
    symbols but don't want to complete on anything else either.  */
-VEC (char_ptr) *
+
+void
 noop_completer (struct completer_data *cdata,
 		struct cmd_list_element *ignore,
 		const char *text, const char *prefix)
 {
-  return NULL;
+  /* Nothing.  */
 }
 
 /* Complete on filenames.  */
-VEC (char_ptr) *
+
+void
 filename_completer (struct completer_data *cdata,
 		    struct cmd_list_element *ignore,
 		    const char *text, const char *word)
 {
   int subsequent_name;
-  VEC (char_ptr) *return_val = NULL;
 
   subsequent_name = 0;
   while (1)
@@ -184,14 +185,12 @@ filename_completer (struct completer_data *cdata,
       switch (add_status)
 	{
 	case MAYBE_ADD_COMPLETION_OK:
-	  VEC_safe_push (char_ptr, return_val, q);
 	  break;
 	case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-	  VEC_safe_push (char_ptr, return_val, q);
-	  return return_val;
+	  return;
 	case MAYBE_ADD_COMPLETION_MAX_REACHED:
 	  xfree (q);
-	  return return_val;
+	  return;
 	case MAYBE_ADD_COMPLETION_DUPLICATE:
 	  xfree (q);
 	  break;
@@ -205,7 +204,6 @@ filename_completer (struct completer_data *cdata,
      with respect to inserting quotes.  */
   rl_completer_word_break_characters = "";
 #endif
-  return return_val;
 }
 
 /* A hashtable traversal function to remove leading file name
@@ -231,14 +229,12 @@ remove_leading_fn_component (void **slot, void *calldata)
    This is intended to be used in commands that set breakpoints
    etc.  */
 
-VEC (char_ptr) *
+void
 location_completer (struct completer_data *cdata,
 		    struct cmd_list_element *ignore,
 		    const char *text, const char *word)
 {
   int n_syms, n_files, ix;
-  VEC (char_ptr) *fn_list = NULL;
-  VEC (char_ptr) *list = NULL;
   const char *p;
   int quote_found = 0;
   int quoted = *text == '\'' || *text == '"';
@@ -309,15 +305,15 @@ location_completer (struct completer_data *cdata,
      symbols as well as on files.  */
   if (colon)
     {
-      list = make_file_symbol_completion_list (cdata, symbol_start, word,
-					       file_to_match);
+      make_file_symbol_completion_list (cdata, symbol_start, word,
+					file_to_match);
       n_syms = get_completion_count (cdata);
       n_files = 0;
       xfree (file_to_match);
     }
   else
     {
-      list = make_symbol_completion_list (cdata, symbol_start, word);
+      make_symbol_completion_list (cdata, symbol_start, word);
       n_syms = get_completion_count (cdata);
       n_files = 0;
       /* If text includes characters which cannot appear in a file
@@ -325,27 +321,11 @@ location_completer (struct completer_data *cdata,
       if (strcspn (text, 
 		   gdb_completer_file_name_break_characters) == text_len)
 	{
-	  fn_list = make_source_files_completion_list (cdata, text, text);
+	  make_source_files_completion_list (cdata, text, text);
 	  n_files = get_completion_count (cdata) - n_syms;
 	}
     }
 
-  /* Catenate fn_list[] onto the end of list[].  */
-  if (!n_syms)
-    {
-      VEC_free (char_ptr, list); /* Paranoia.  */
-      list = fn_list;
-      fn_list = NULL;
-    }
-  else
-    {
-      char *fn;
-
-      for (ix = 0; VEC_iterate (char_ptr, fn_list, ix, fn); ++ix)
-	VEC_safe_push (char_ptr, list, fn);
-      VEC_free (char_ptr, fn_list);
-    }
-
   if (n_syms && n_files)
     {
       /* Nothing.  */
@@ -376,18 +356,15 @@ location_completer (struct completer_data *cdata,
     {
       /* No completions at all.  As the final resort, try completing
 	 on the entire text as a symbol.  */
-      list = make_symbol_completion_list (cdata, orig_text, word);
+      make_symbol_completion_list (cdata, orig_text, word);
     }
-
-  return list;
 }
 
 /* Helper for expression_completer which recursively adds field and
    method names from TYPE, a struct or union type, to the array
    OUTPUT.  */
 static void
-add_struct_fields (struct completer_data *cdata,
-		   struct type *type, VEC (char_ptr) **output,
+add_struct_fields (struct completer_data *cdata, struct type *type,
 		   char *fieldname, int namelen)
 {
   int i;
@@ -399,7 +376,7 @@ add_struct_fields (struct completer_data *cdata,
     {
       if (i < TYPE_N_BASECLASSES (type))
 	add_struct_fields (cdata, TYPE_BASECLASS (type, i),
-			   output, fieldname, namelen);
+			   fieldname, namelen);
       else if (TYPE_FIELD_NAME (type, i))
 	{
 	  if (TYPE_FIELD_NAME (type, i)[0] != '\0')
@@ -414,10 +391,8 @@ add_struct_fields (struct completer_data *cdata,
 		  switch (add_status)
 		    {
 		    case MAYBE_ADD_COMPLETION_OK:
-		      VEC_safe_push (char_ptr, *output, match);
 		      break;
 		    case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-		      VEC_safe_push (char_ptr, *output, match);
 		      return;
 		    case MAYBE_ADD_COMPLETION_MAX_REACHED:
 		      xfree (match);
@@ -432,7 +407,7 @@ add_struct_fields (struct completer_data *cdata,
 	    {
 	      /* Recurse into anonymous unions.  */
 	      add_struct_fields (cdata, TYPE_FIELD_TYPE (type, i),
-				 output, fieldname, namelen);
+				 fieldname, namelen);
 	    }
 	}
     }
@@ -458,10 +433,8 @@ add_struct_fields (struct completer_data *cdata,
 	      switch (add_status)
 		{
 		case MAYBE_ADD_COMPLETION_OK:
-		  VEC_safe_push (char_ptr, *output, match);
 		  break;
 		case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-		  VEC_safe_push (char_ptr, *output, match);
 		  return;
 		case MAYBE_ADD_COMPLETION_MAX_REACHED:
 		  xfree (match);
@@ -478,7 +451,8 @@ add_struct_fields (struct completer_data *cdata,
 /* Complete on expressions.  Often this means completing on symbol
    names, but some language parsers also have support for completing
    field names.  */
-VEC (char_ptr) *
+
+void
 expression_completer (struct completer_data *cdata,
 		      struct cmd_list_element *ignore,
 		      const char *text, const char *word)
@@ -497,7 +471,7 @@ expression_completer (struct completer_data *cdata,
     }
   CATCH (except, RETURN_MASK_ERROR)
     {
-      return NULL;
+      return;
     }
   END_CATCH
 
@@ -516,22 +490,19 @@ expression_completer (struct completer_data *cdata,
 	  || TYPE_CODE (type) == TYPE_CODE_STRUCT)
 	{
 	  int flen = strlen (fieldname);
-	  VEC (char_ptr) *result = NULL;
 
-	  add_struct_fields (cdata, type, &result, fieldname, flen);
+	  add_struct_fields (cdata, type, fieldname, flen);
 	  xfree (fieldname);
-	  return result;
+	  return;
 	}
     }
   else if (fieldname && code != TYPE_CODE_UNDEF)
     {
-      VEC (char_ptr) *result;
       struct cleanup *cleanup = make_cleanup (xfree, fieldname);
 
-      result
-	= make_symbol_completion_type (cdata, fieldname, fieldname, code);
+      make_symbol_completion_type (cdata, fieldname, fieldname, code);
       do_cleanups (cleanup);
-      return result;
+      return;
     }
   xfree (fieldname);
 
@@ -543,7 +514,7 @@ expression_completer (struct completer_data *cdata,
     ;
 
   /* Not ideal but it is what we used to do before...  */
-  return location_completer (cdata, ignore, p, word);
+  location_completer (cdata, ignore, p, word);
 }
 
 /* See definition in completer.h.  */
@@ -620,12 +591,11 @@ complete_line_internal_reason;
    once sub-command completions are exhausted, we simply return NULL.
  */
 
-static VEC (char_ptr) *
+static void
 complete_line_internal (struct completer_data *cdata,
 			const char *text, const char *line_buffer, int point,
 			complete_line_internal_reason reason)
 {
-  VEC (char_ptr) *list = NULL;
   char *tmp_command;
   const char *p;
   int ignore_help_classes;
@@ -680,7 +650,7 @@ complete_line_internal (struct completer_data *cdata,
     {
       /* It is an unrecognized command.  So there are no
 	 possible completions.  */
-      list = NULL;
+      return;
     }
   else if (c == CMD_LIST_AMBIGUOUS)
     {
@@ -698,7 +668,7 @@ complete_line_internal (struct completer_data *cdata,
 	     example, "info t " or "info t foo" does not complete
 	     to anything, because "info t" can be "info target" or
 	     "info terminal".  */
-	  list = NULL;
+	  return;
 	}
       else
 	{
@@ -707,14 +677,14 @@ complete_line_internal (struct completer_data *cdata,
 	  if (result_list)
 	    {
 	      if (reason != handle_brkchars)
-		list = complete_on_cmdlist (cdata, *result_list->prefixlist,
-					    p, word, ignore_help_classes);
+		complete_on_cmdlist (cdata, *result_list->prefixlist,
+				     p, word, ignore_help_classes);
 	    }
 	  else
 	    {
 	      if (reason != handle_brkchars)
-		list = complete_on_cmdlist (cdata, cmdlist, p, word,
-					    ignore_help_classes);
+		complete_on_cmdlist (cdata, cmdlist, p, word,
+				     ignore_help_classes);
 	    }
 	  /* Ensure that readline does the right thing with respect to
 	     inserting quotes.  */
@@ -740,8 +710,8 @@ complete_line_internal (struct completer_data *cdata,
 		  /* It is a prefix command; what comes after it is
 		     a subcommand (e.g. "info ").  */
 		  if (reason != handle_brkchars)
-		    list = complete_on_cmdlist (cdata, *c->prefixlist, p,
-						word, ignore_help_classes);
+		    complete_on_cmdlist (cdata, *c->prefixlist, p,
+					 word, ignore_help_classes);
 
 		  /* Ensure that readline does the right thing
 		     with respect to inserting quotes.  */
@@ -749,11 +719,11 @@ complete_line_internal (struct completer_data *cdata,
 		    gdb_completer_command_word_break_characters;
 		}
 	      else if (reason == handle_help)
-		list = NULL;
+		return;
 	      else if (c->enums)
 		{
 		  if (reason != handle_brkchars)
-		    list = complete_on_enum (cdata, c->enums, p, word);
+		    complete_on_enum (cdata, c->enums, p, word);
 		  rl_completer_word_break_characters =
 		    gdb_completer_command_word_break_characters;
 		}
@@ -793,7 +763,7 @@ complete_line_internal (struct completer_data *cdata,
 		      && c->completer_handle_brkchars != NULL)
 		    (*c->completer_handle_brkchars) (c, p, word);
 		  if (reason != handle_brkchars && c->completer != NULL)
-		    list = (*c->completer) (cdata, c, p, word);
+		    (*c->completer) (cdata, c, p, word);
 		}
 	    }
 	  else
@@ -815,8 +785,8 @@ complete_line_internal (struct completer_data *cdata,
 		}
 
 	      if (reason != handle_brkchars)
-		list = complete_on_cmdlist (cdata, result_list, q, word,
-					    ignore_help_classes);
+		complete_on_cmdlist (cdata, result_list, q, word,
+				     ignore_help_classes);
 
 	      /* Ensure that readline does the right thing
 		 with respect to inserting quotes.  */
@@ -825,7 +795,7 @@ complete_line_internal (struct completer_data *cdata,
 	    }
 	}
       else if (reason == handle_help)
-	list = NULL;
+	return;
       else
 	{
 	  /* There is non-whitespace beyond the command.  */
@@ -834,12 +804,12 @@ complete_line_internal (struct completer_data *cdata,
 	    {
 	      /* It is an unrecognized subcommand of a prefix command,
 		 e.g. "info adsfkdj".  */
-	      list = NULL;
+	      return;
 	    }
 	  else if (c->enums)
 	    {
 	      if (reason != handle_brkchars)
-		list = complete_on_enum (cdata, c->enums, p, word);
+		complete_on_enum (cdata, c->enums, p, word);
 	    }
 	  else
 	    {
@@ -869,12 +839,10 @@ complete_line_internal (struct completer_data *cdata,
 		  && c->completer_handle_brkchars != NULL)
 		(*c->completer_handle_brkchars) (c, p, word);
 	      if (reason != handle_brkchars && c->completer != NULL)
-		list = (*c->completer) (cdata, c, p, word);
+		(*c->completer) (cdata, c, p, word);
 	    }
 	}
     }
-
-  return list;
 }
 
 /* Allocate a new completer data structure.  */
@@ -955,7 +923,6 @@ get_completion_count (const struct completer_data *cdata)
   return htab_elements (cdata->tracker);
 }
 
-
 /* See completer.h.  */
 
 int
@@ -1033,23 +1000,23 @@ complete_line (const char *text, const char *line_buffer, int point)
 }
 
 /* Complete on command names.  Used by "help".  */
-VEC (char_ptr) *
+
+void
 command_completer (struct completer_data *cdata,
 		   struct cmd_list_element *ignore,
 		   const char *text, const char *word)
 {
-  return complete_line_internal (cdata, word, text,
-				 strlen (text), handle_help);
+  complete_line_internal (cdata, word, text,
+			  strlen (text), handle_help);
 }
 
 /* Complete on signals.  */
 
-VEC (char_ptr) *
+void
 signal_completer (struct completer_data *cdata,
 		  struct cmd_list_element *ignore,
 		  const char *text, const char *word)
 {
-  VEC (char_ptr) *return_val = NULL;
   size_t len = strlen (word);
   int signum;
   const char *signame;
@@ -1075,32 +1042,27 @@ signal_completer (struct completer_data *cdata,
 	  switch (add_status)
 	    {
 	    case MAYBE_ADD_COMPLETION_OK:
-	      VEC_safe_push (char_ptr, return_val, completion);
 	      break;
 	    case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-	      VEC_safe_push (char_ptr, return_val, completion);
-	      return return_val;
+	      return;
 	    case MAYBE_ADD_COMPLETION_MAX_REACHED:
 	      xfree (completion);
-	      return return_val;
+	      return;
 	    case MAYBE_ADD_COMPLETION_DUPLICATE:
 	      xfree (completion);
 	      break;
 	    }
 	}
     }
-
-  return return_val;
 }
 
 /* Complete on a register or reggroup.  */
 
-VEC (char_ptr) *
+void
 reg_or_group_completer (struct completer_data *cdata,
 			struct cmd_list_element *ignore,
 			const char *text, const char *word)
 {
-  VEC (char_ptr) *result = NULL;
   size_t len = strlen (word);
   struct gdbarch *gdbarch;
   struct reggroup *group;
@@ -1109,7 +1071,7 @@ reg_or_group_completer (struct completer_data *cdata,
   enum maybe_add_completion_enum add_status;
 
   if (!target_has_registers)
-    return result;
+    return;
 
   gdbarch = get_frame_arch (get_selected_frame (NULL));
 
@@ -1125,14 +1087,12 @@ reg_or_group_completer (struct completer_data *cdata,
 	  switch (add_status)
 	    {
 	    case MAYBE_ADD_COMPLETION_OK:
-	      VEC_safe_push (char_ptr, result, match);
 	      break;
 	    case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-	      VEC_safe_push (char_ptr, result, match);
-	      return result;
+	      return;
 	    case MAYBE_ADD_COMPLETION_MAX_REACHED:
 	      xfree (match);
-	      return result;
+	      return;
 	    case MAYBE_ADD_COMPLETION_DUPLICATE:
 	      xfree (match);
 	      break;
@@ -1152,22 +1112,18 @@ reg_or_group_completer (struct completer_data *cdata,
 	  switch (add_status)
 	    {
 	    case MAYBE_ADD_COMPLETION_OK:
-	      VEC_safe_push (char_ptr, result, match);
 	      break;
 	    case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-	      VEC_safe_push (char_ptr, result, match);
-	      return result;
+	      return;
 	    case MAYBE_ADD_COMPLETION_MAX_REACHED:
 	      xfree (match);
-	      return result;
+	      return;
 	    case MAYBE_ADD_COMPLETION_DUPLICATE:
 	      xfree (match);
 	      break;
 	    }
 	}
     }
-
-  return result;
 }
 
 
diff --git a/gdb/completer.h b/gdb/completer.h
index 0724590..8a01d9f 100644
--- a/gdb/completer.h
+++ b/gdb/completer.h
@@ -76,33 +76,33 @@ extern VEC (char_ptr) *complete_line (const char *text,
 extern char *readline_line_completion_function (const char *text,
 						int matches);
 
-extern VEC (char_ptr) *noop_completer (struct completer_data *,
-				       struct cmd_list_element *,
-				       const char *, const char *);
+extern void noop_completer (struct completer_data *,
+			    struct cmd_list_element *,
+			    const char *, const char *);
 
-extern VEC (char_ptr) *filename_completer (struct completer_data *,
-					   struct cmd_list_element *,
-					   const char *, const char *);
+extern void filename_completer (struct completer_data *,
+				struct cmd_list_element *,
+				const char *, const char *);
 
-extern VEC (char_ptr) *expression_completer (struct completer_data *,
-					     struct cmd_list_element *,
-					     const char *, const char *);
+extern void expression_completer (struct completer_data *,
+				  struct cmd_list_element *,
+				  const char *, const char *);
 
-extern VEC (char_ptr) *location_completer (struct completer_data *,
-					   struct cmd_list_element *,
-					   const char *, const char *);
+extern void location_completer (struct completer_data *,
+				struct cmd_list_element *,
+				const char *, const char *);
 
-extern VEC (char_ptr) *command_completer (struct completer_data *,
-					  struct cmd_list_element *,
-					  const char *, const char *);
+extern void command_completer (struct completer_data *,
+			       struct cmd_list_element *,
+			       const char *, const char *);
 
-extern VEC (char_ptr) *signal_completer (struct completer_data *,
-					 struct cmd_list_element *,
-					 const char *, const char *);
+extern void signal_completer (struct completer_data *,
+			      struct cmd_list_element *,
+			      const char *, const char *);
 
-extern VEC (char_ptr) *reg_or_group_completer (struct completer_data *,
-					       struct cmd_list_element *,
-					       const char *, const char *);
+extern void reg_or_group_completer (struct completer_data *,
+				    struct cmd_list_element *,
+				    const char *, const char *);
 
 extern char *get_gdb_completer_quote_characters (void);
 
@@ -161,11 +161,11 @@ enum maybe_add_completion_enum
 
 /* Add the completion NAME to the list of generated completions if
    it is not there already.
-   If max_completions is negative, nothing is done, not even watching
-   for duplicates, and MAYBE_ADD_COMPLETION_OK is always returned.
+   If max_completions is negative, completions are not limited, but
+   duplicates are filtered.  MAYBE_ADD_COMPLETION_OK is always returned.
 
-   If MAYBE_ADD_COMPLETION_MAX_REACHED is returned, callers are required to
-   record at least one more completion.  The final list will be pruned to
+   If MAYBE_ADD_COMPLETION_OK_MAX_REACHED is returned, callers are required
+   to record at least one more completion.  The final list will be limited to
    max_completions, but recording at least one more than max_completions is
    the signal to the completion machinery that too many completions were
    found.  */
diff --git a/gdb/corefile.c b/gdb/corefile.c
index b5ec0e0..4b8d504 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -467,7 +467,7 @@ set_gnutarget_command (char *ignore, int from_tty,
 
 /* A completion function for "set gnutarget".  */
 
-static VEC (char_ptr) *
+static void
 complete_set_gnutarget (struct completer_data *cdata,
 			struct cmd_list_element *cmd,
 			const char *text, const char *word)
@@ -487,7 +487,7 @@ complete_set_gnutarget (struct completer_data *cdata,
       bfd_targets[last + 1] = NULL;
     }
 
-  return complete_on_enum (cdata, bfd_targets, text, word);
+  complete_on_enum (cdata, bfd_targets, text, word);
 }
 
 /* Set the gnutarget.  */
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index 504bb20..cddc382 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -358,7 +358,7 @@ set_cp_abi_cmd (char *args, int from_tty)
 
 /* A completion function for "set cp-abi".  */
 
-static VEC (char_ptr) *
+static void
 cp_abi_completer (struct completer_data *cdata,
 		  struct cmd_list_element *ignore,
 		  const char *text, const char *word)
@@ -375,7 +375,7 @@ cp_abi_completer (struct completer_data *cdata,
       cp_abi_names[i] = NULL;
     }
 
-  return complete_on_enum (cdata, cp_abi_names, text, word);
+  complete_on_enum (cdata, cp_abi_names, text, word);
 }
 
 /* Show the currently selected C++ ABI.  */
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 6852b08..ed278fc 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -228,13 +228,13 @@ f_word_break_characters (void)
 /* Consider the modules separator :: as a valid symbol name character
    class.  */
 
-static VEC (char_ptr) *
+static void
 f_make_symbol_completion_list (struct completer_data *cdata,
 			       const char *text, const char *word,
 			       enum type_code code)
 {
-  return default_make_symbol_completion_list_break_on (cdata, text, word,
-						       ":", code);
+  default_make_symbol_completion_list_break_on (cdata, text, word,
+						":", code);
 }
 
 const struct language_defn f_language_defn =
diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
index 1680c27..86fc321 100644
--- a/gdb/guile/scm-cmd.c
+++ b/gdb/guile/scm-cmd.c
@@ -348,8 +348,7 @@ cmdscm_bad_completion_result (const char *msg, SCM completion)
    The result is a boolean indicating success.  */
 
 static int
-cmdscm_add_completion (SCM completion, struct completer_data *cdata,
-		       VEC (char_ptr) **result)
+cmdscm_add_completion (SCM completion, struct completer_data *cdata)
 {
   char *item;
   SCM except_scm;
@@ -377,7 +376,6 @@ cmdscm_add_completion (SCM completion, struct completer_data *cdata,
     {
     case MAYBE_ADD_COMPLETION_OK:
     case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-      VEC_safe_push (char_ptr, *result, item);
       break;
     case MAYBE_ADD_COMPLETION_MAX_REACHED:
     case MAYBE_ADD_COMPLETION_DUPLICATE:
@@ -390,7 +388,7 @@ cmdscm_add_completion (SCM completion, struct completer_data *cdata,
 
 /* Called by gdb for command completion.  */
 
-static VEC (char_ptr) *
+static void
 cmdscm_completer (struct completer_data *cdata,
 		  struct cmd_list_element *command,
 		  const char *text, const char *word)
@@ -398,7 +396,6 @@ cmdscm_completer (struct completer_data *cdata,
   command_smob *c_smob/*obj*/ = (command_smob *) get_cmd_context (command);
   SCM completer_result_scm;
   SCM text_scm, word_scm, result_scm;
-  VEC (char_ptr) *result = NULL;
 
   gdb_assert (c_smob != NULL);
   gdb_assert (gdbscm_is_procedure (c_smob->complete));
@@ -420,7 +417,7 @@ cmdscm_completer (struct completer_data *cdata,
     {
       /* Inform the user, but otherwise ignore.  */
       gdbscm_print_gdb_exception (SCM_BOOL_F, completer_result_scm);
-      goto done;
+      return;
     }
 
   if (gdbscm_is_true (scm_list_p (completer_result_scm)))
@@ -431,11 +428,8 @@ cmdscm_completer (struct completer_data *cdata,
 	{
 	  SCM next = scm_car (list);
 
-	  if (!cmdscm_add_completion (next, cdata, &result))
-	    {
-	      VEC_free (char_ptr, result);
-	      goto done;
-	    }
+	  if (!cmdscm_add_completion (next, cdata))
+	    return;
 
 	  list = scm_cdr (list);
 	}
@@ -451,15 +445,11 @@ cmdscm_completer (struct completer_data *cdata,
 	    {
 	      /* Inform the user, but otherwise ignore the entire result.  */
 	      gdbscm_print_gdb_exception (SCM_BOOL_F, completer_result_scm);
-	      VEC_free (char_ptr, result);
-	      goto done;
+	      return;
 	    }
 
-	  if (!cmdscm_add_completion (next, cdata, &result))
-	    {
-	      VEC_free (char_ptr, result);
-	      goto done;
-	    }
+	  if (!cmdscm_add_completion (next, cdata))
+	    return;
 
 	  next = itscm_safe_call_next_x (iter, NULL);
 	}
@@ -470,9 +460,6 @@ cmdscm_completer (struct completer_data *cdata,
       cmdscm_bad_completion_result (_("Bad completer result: "),
 				    completer_result_scm);
     }
-
- done:
-  return result;
 }
 
 /* Helper for gdbscm_make_command which locates the command list to use and
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 23f193f..645d854 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -7071,12 +7071,11 @@ Are you sure you want to change it? "),
 
 /* Complete the "handle" command.  */
 
-static VEC (char_ptr) *
+static void
 handle_completer (struct completer_data *cdata,
 		  struct cmd_list_element *ignore,
 		  const char *text, const char *word)
 {
-  VEC (char_ptr) *vec_signals, *vec_keywords, *return_val;
   static const char * const keywords[] =
     {
       "all",
@@ -7091,13 +7090,8 @@ handle_completer (struct completer_data *cdata,
       NULL,
     };
 
-  vec_signals = signal_completer (cdata, ignore, text, word);
-  vec_keywords = complete_on_enum (cdata, keywords, word, word);
-
-  return_val = VEC_merge (char_ptr, vec_signals, vec_keywords);
-  VEC_free (char_ptr, vec_signals);
-  VEC_free (char_ptr, vec_keywords);
-  return return_val;
+  signal_completer (cdata, ignore, text, word);
+  complete_on_enum (cdata, keywords, word, word);
 }
 
 enum gdb_signal
diff --git a/gdb/interps.c b/gdb/interps.c
index 085cac5..87c38d1 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -436,13 +436,12 @@ interpreter_exec_cmd (char *args, int from_tty)
 }
 
 /* List the possible interpreters which could complete the given text.  */
-static VEC (char_ptr) *
+static void
 interpreter_completer (struct completer_data *cdata,
 		       struct cmd_list_element *ignore,
 		       const char *text, const char *word)
 {
   int textlen;
-  VEC (char_ptr) *matches = NULL;
   struct interp *interp;
 
   textlen = strlen (text);
@@ -473,22 +472,18 @@ interpreter_completer (struct completer_data *cdata,
 	  switch (add_status)
 	    {
 	    case MAYBE_ADD_COMPLETION_OK:
-	      VEC_safe_push (char_ptr, matches, match);
 	      break;
 	    case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-	      VEC_safe_push (char_ptr, matches, match);
-	      return matches;
+	      return;
 	    case MAYBE_ADD_COMPLETION_MAX_REACHED:
 	      xfree (match);
-	      return matches;
+	      return;
 	    case MAYBE_ADD_COMPLETION_DUPLICATE:
 	      xfree (match);
 	      break;
 	    }
 	}
     }
-
-  return matches;
 }
 
 struct interp *
diff --git a/gdb/language.h b/gdb/language.h
index 17b670e..b76f496 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -301,7 +301,7 @@ struct language_defn
        completion is being made.  If CODE is TYPE_CODE_UNDEF, then all
        symbols should be examined; otherwise, only STRUCT_DOMAIN
        symbols whose type has a code of CODE should be matched.  */
-    VEC (char_ptr) *
+    void
       (*la_make_symbol_completion_list) (struct completer_data *,
 					 const char *text,
 					 const char *word,
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index 7926157..1880529 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -330,13 +330,12 @@ cmdpy_completer_handle_brkchars (struct cmd_list_element *command,
 
 /* Called by gdb for command completion.  */
 
-static VEC (char_ptr) *
+static void
 cmdpy_completer (struct completer_data *cdata,
 		 struct cmd_list_element *command,
 		 const char *text, const char *word)
 {
   PyObject *resultobj = NULL;
-  VEC (char_ptr) *result = NULL;
   struct cleanup *cleanup;
 
   cleanup = ensure_python_env (get_current_arch (), current_language);
@@ -351,7 +350,6 @@ cmdpy_completer (struct completer_data *cdata,
   if (resultobj == NULL)
     goto done;
 
-  result = NULL;
   if (PyInt_Check (resultobj))
     {
       /* User code may also return one of the completion constants,
@@ -364,7 +362,7 @@ cmdpy_completer (struct completer_data *cdata,
 	  PyErr_Clear ();
 	}
       else if (value >= 0 && value < (long) N_COMPLETERS)
-	result = completers[value].completer (cdata, command, text, word);
+	completers[value].completer (cdata, command, text, word);
     }
   else
     {
@@ -399,10 +397,8 @@ cmdpy_completer (struct completer_data *cdata,
 	  switch (add_status)
 	    {
 	    case MAYBE_ADD_COMPLETION_OK:
-	      VEC_safe_push (char_ptr, result, item);
 	      break;
 	    case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-	      VEC_safe_push (char_ptr, result, item);
 	      stop = 1;
 	      break;
 	    case MAYBE_ADD_COMPLETION_MAX_REACHED:
@@ -427,8 +423,6 @@ cmdpy_completer (struct completer_data *cdata,
 
   Py_XDECREF (resultobj);
   do_cleanups (cleanup);
-
-  return result;
 }
 
 /* Helper for cmdpy_init which locates the command list to use and
diff --git a/gdb/symtab.c b/gdb/symtab.c
index d997a33..a5a3c2a 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -4982,31 +4982,8 @@ compare_symbol_name (const char *name, const char *sym_text, int sym_text_len)
   return 1;
 }
 
-/* Free any memory associated with a completion list.  */
-
-static void
-free_completion_list (VEC (char_ptr) **list_ptr)
-{
-  int i;
-  char *p;
-
-  for (i = 0; VEC_iterate (char_ptr, *list_ptr, i, p); ++i)
-    xfree (p);
-  VEC_free (char_ptr, *list_ptr);
-}
-
-/* Callback for make_cleanup.  */
-
-static void
-do_free_completion_list (void *list)
-{
-  free_completion_list (list);
-}
-
 /* Helper routine for make_symbol_completion_list.  */
 
-static VEC (char_ptr) *return_val;
-
 #define COMPLETION_LIST_ADD_SYMBOL(cdata, symbol, sym_text, len,	\
 				   text, word)				\
   completion_list_add_name						\
@@ -5063,10 +5040,8 @@ completion_list_add_name (struct completer_data *cdata,
     switch (add_status)
       {
       case MAYBE_ADD_COMPLETION_OK:
-	VEC_safe_push (char_ptr, return_val, newobj);
 	break;
       case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-	VEC_safe_push (char_ptr, return_val, newobj);
 	throw_max_completions_reached_error ();
       case MAYBE_ADD_COMPLETION_MAX_REACHED:
 	xfree (newobj);
@@ -5509,18 +5484,13 @@ default_make_symbol_completion_list_break_on_1 (struct completer_data *cdata,
     }
 }
 
-VEC (char_ptr) *
+void
 default_make_symbol_completion_list_break_on (struct completer_data *cdata,
 					      const char *text,
 					      const char *word,
 					      const char *break_on,
 					      enum type_code code)
 {
-  struct cleanup *back_to;
-
-  return_val = NULL;
-  back_to = make_cleanup (do_free_completion_list, &return_val);
-
   TRY
     {
       default_make_symbol_completion_list_break_on_1 (cdata, text, word,
@@ -5532,61 +5502,56 @@ default_make_symbol_completion_list_break_on (struct completer_data *cdata,
 	throw_exception (except);
     }
   END_CATCH
-
-  discard_cleanups (back_to);
-  return return_val;
 }
 
-VEC (char_ptr) *
+void
 default_make_symbol_completion_list (struct completer_data *cdata,
 				     const char *text, const char *word,
 				     enum type_code code)
 {
-  return default_make_symbol_completion_list_break_on (cdata, text, word, "",
-						       code);
+  default_make_symbol_completion_list_break_on (cdata, text, word, "", code);
 }
 
 /* Return a vector of all symbols (regardless of class) which begin by
    matching TEXT.  If the answer is no symbols, then the return value
    is NULL.  */
 
-VEC (char_ptr) *
+void
 make_symbol_completion_list (struct completer_data *cdata,
 			     const char *text, const char *word)
 {
-  return current_language->la_make_symbol_completion_list (cdata, text, word,
-							   TYPE_CODE_UNDEF);
+  current_language->la_make_symbol_completion_list (cdata, text, word,
+						    TYPE_CODE_UNDEF);
 }
 
 /* Like make_symbol_completion_list, but only return STRUCT_DOMAIN
    symbols whose type code is CODE.  */
 
-VEC (char_ptr) *
+void
 make_symbol_completion_type (struct completer_data *cdata, const char *text,
 			     const char *word, enum type_code code)
 {
   gdb_assert (code == TYPE_CODE_UNION
 	      || code == TYPE_CODE_STRUCT
 	      || code == TYPE_CODE_ENUM);
-  return current_language->la_make_symbol_completion_list (cdata, text, word,
-							   code);
+  current_language->la_make_symbol_completion_list (cdata, text, word, code);
 }
 
 /* Like make_symbol_completion_list, but suitable for use as a
    completion function.  */
 
-VEC (char_ptr) *
+void
 make_symbol_completion_list_fn (struct completer_data *cdata,
 				struct cmd_list_element *ignore,
 				const char *text, const char *word)
 {
-  return make_symbol_completion_list (cdata, text, word);
+  make_symbol_completion_list (cdata, text, word);
 }
 
 /* Like make_symbol_completion_list, but returns a list of symbols
    defined in a source file FILE.  */
 
-VEC (char_ptr) *
+void
 make_file_symbol_completion_list (struct completer_data *cdata,
 				  const char *text, const char *word,
 				  const char *srcfile)
@@ -5634,7 +5599,7 @@ make_file_symbol_completion_list (struct completer_data *cdata,
       /* A double-quoted string is never a symbol, nor does it make sense
          to complete it any other way.  */
       {
-	return NULL;
+	return;
       }
     else
       {
@@ -5645,8 +5610,6 @@ make_file_symbol_completion_list (struct completer_data *cdata,
 
   sym_text_len = strlen (sym_text);
 
-  return_val = NULL;
-
   /* Find the symtab for SRCFILE (this loads it if it was not yet read
      in).  */
   s = lookup_symtab (srcfile);
@@ -5662,7 +5625,7 @@ make_file_symbol_completion_list (struct completer_data *cdata,
 
   /* If we have no symtab for that file, return an empty list.  */
   if (s == NULL)
-    return (return_val);
+    return;
 
   /* Go through this symtab and check the externs and statics for
      symbols which match.  */
@@ -5680,8 +5643,6 @@ make_file_symbol_completion_list (struct completer_data *cdata,
       COMPLETION_LIST_ADD_SYMBOL (cdata, sym, sym_text, sym_text_len,
 				  text, word);
     }
-
-  return (return_val);
 }
 
 /* A helper function for make_source_files_completion_list.  It adds
@@ -5690,8 +5651,7 @@ make_file_symbol_completion_list (struct completer_data *cdata,
 
 static void
 add_filename_to_list (struct completer_data *cdata, const char *fname,
-		      const char *text, const char *word,
-		      VEC (char_ptr) **list)
+		      const char *text, const char *word)
 {
   char *newobj;
   size_t fnlen = strlen (fname);
@@ -5724,16 +5684,10 @@ add_filename_to_list (struct completer_data *cdata, const char *fname,
   switch (add_status)
     {
     case MAYBE_ADD_COMPLETION_OK:
-      VEC_safe_push (char_ptr, *list, newobj);
-      discard_cleanups (cleanup);
-      break;
     case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-      VEC_safe_push (char_ptr, *list, newobj);
       discard_cleanups (cleanup);
       break;
     case MAYBE_ADD_COMPLETION_MAX_REACHED:
-      do_cleanups (cleanup);
-      break;
     case MAYBE_ADD_COMPLETION_DUPLICATE:
       do_cleanups (cleanup);
       break;
@@ -5765,7 +5719,6 @@ struct add_partial_filename_data
   const char *text;
   const char *word;
   int text_len;
-  VEC (char_ptr) **list;
 
   /* Completion data used by the completer function.  */
   struct completer_data *completer_data;
@@ -5787,7 +5740,7 @@ maybe_add_partial_symtab_filename (const char *filename, const char *fullname,
       /* This file matches for a completion; add it to the
 	 current list of matches.  */
       add_filename_to_list (data->completer_data, filename, data->text,
-			    data->word, data->list);
+			    data->word);
     }
   else
     {
@@ -5798,17 +5751,16 @@ maybe_add_partial_symtab_filename (const char *filename, const char *fullname,
 	  && filename_ncmp (base_name, data->text, data->text_len) == 0)
 	{
 	  add_filename_to_list (data->completer_data, base_name, data->text,
-				data->word, data->list);
+				data->word);
 	}
     }
 }
 
-/* Return a vector of all source files whose names begin with matching
-   TEXT.  The file names are looked up in the symbol tables of this
-   program.  If the answer is no matchess, then the return value is
-   NULL.  */
+/* Add all source files whose names begin with matching TEXT to CDATA.
+   The file names are looked up in the symbol tables of this program.
+   If the answer is no matchess, then the return value is NULL.  */
 
-VEC (char_ptr) *
+void
 make_source_files_completion_list (struct completer_data *cdata,
 				   const char *text, const char *word)
 {
@@ -5816,16 +5768,13 @@ make_source_files_completion_list (struct completer_data *cdata,
   struct symtab *s;
   struct objfile *objfile;
   size_t text_len = strlen (text);
-  VEC (char_ptr) *list = NULL;
   const char *base_name;
   struct add_partial_filename_data datum;
   struct filename_seen_cache *filename_seen_cache;
-  struct cleanup *back_to, *cache_cleanup;
+  struct cleanup *cache_cleanup;
 
   if (!have_full_symbols () && !have_partial_symbols ())
-    return list;
-
-  back_to = make_cleanup (do_free_completion_list, &list);
+    return;
 
   filename_seen_cache = create_filename_seen_cache ();
   cache_cleanup = make_cleanup (delete_filename_seen_cache,
@@ -5840,7 +5789,7 @@ make_source_files_completion_list (struct completer_data *cdata,
 	{
 	  /* This file matches for a completion; add it to the current
 	     list of matches.  */
-	  add_filename_to_list (cdata, s->filename, text, word, &list);
+	  add_filename_to_list (cdata, s->filename, text, word);
 	}
       else
 	{
@@ -5852,7 +5801,7 @@ make_source_files_completion_list (struct completer_data *cdata,
 	  if (base_name != s->filename
 	      && !filename_seen (filename_seen_cache, base_name, 1)
 	      && filename_ncmp (base_name, text, text_len) == 0)
-	    add_filename_to_list (cdata, base_name, text, word, &list);
+	    add_filename_to_list (cdata, base_name, text, word);
 	}
     }
 
@@ -5860,15 +5809,11 @@ make_source_files_completion_list (struct completer_data *cdata,
   datum.text = text;
   datum.word = word;
   datum.text_len = text_len;
-  datum.list = &list;
   datum.completer_data = cdata;
   map_symbol_filenames (maybe_add_partial_symtab_filename, &datum,
 			0 /*need_fullname*/);
 
   do_cleanups (cache_cleanup);
-  discard_cleanups (back_to);
-
-  return list;
 }
 
 /* Track MAIN */
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 508a7e5..eb6e8f2 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1445,30 +1445,31 @@ extern void forget_cached_source_info (void);
 
 extern void select_source_symtab (struct symtab *);
 
-extern VEC (char_ptr) *default_make_symbol_completion_list_break_on
+extern void default_make_symbol_completion_list_break_on
  (struct completer_data *cdata, const char *text, const char *word,
   const char *break_on, enum type_code code);
-extern VEC (char_ptr) *
+
+extern void
  default_make_symbol_completion_list (struct completer_data *,
 				      const char *, const char *,
 				      enum type_code);
-extern VEC (char_ptr) *
+extern void
   make_symbol_completion_list (struct completer_data *, const char *,
 			       const char *);
-extern VEC (char_ptr) *
+extern void
   make_symbol_completion_type (struct completer_data *,
 			       const char *, const char *,
 			       enum type_code);
-extern VEC (char_ptr) *
+extern void
   make_symbol_completion_list_fn (struct completer_data *,
 				  struct cmd_list_element *,
 				  const char *, const char *);
 
-extern VEC (char_ptr) *
+extern void
   make_file_symbol_completion_list (struct completer_data *,
 				    const char *, const char *, const char *);
 
-extern VEC (char_ptr) *
+extern void
  make_source_files_completion_list (struct completer_data *, const char *,
 				    const char *);
 
diff --git a/gdb/value.c b/gdb/value.c
index 8519b91..b5b82c5 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2029,10 +2029,9 @@ lookup_only_internalvar (const char *name)
    Returns a vector of newly allocated strings, or NULL if no matches
    were found.  */
 
-VEC (char_ptr) *
+void
 complete_internalvar (struct completer_data *cdata, const char *name)
 {
-  VEC (char_ptr) *result = NULL;
   struct internalvar *var;
   int len;
 
@@ -2048,21 +2047,17 @@ complete_internalvar (struct completer_data *cdata, const char *name)
 	switch (add_status)
 	  {
 	  case MAYBE_ADD_COMPLETION_OK:
-	    VEC_safe_push (char_ptr, result, r);
 	    break;
 	  case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-	    VEC_safe_push (char_ptr, result, r);
-	    return result;
+	    return;
 	  case MAYBE_ADD_COMPLETION_MAX_REACHED:
 	    xfree (r);
-	    return result;
+	    return;
 	  case MAYBE_ADD_COMPLETION_DUPLICATE:
 	    xfree (r);
 	    break;
 	  }
       }
-
-  return result;
 }
 
 /* Create an internal variable with name NAME and with a void value.
diff --git a/gdb/value.h b/gdb/value.h
index 41aec1b..f44e5a1 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -872,8 +872,8 @@ extern struct internalvar *lookup_only_internalvar (const char *name);
 
 extern struct internalvar *create_internalvar (const char *name);
 
-extern VEC (char_ptr) *complete_internalvar (struct completer_data *cdata,
-					     const char *name);
+extern void complete_internalvar (struct completer_data *cdata,
+				  const char *name);
 
 /* An internalvar can be dynamically computed by supplying a vector of
    function pointers to perform various operations.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]