diff options
author | Tom Tromey <tromey@redhat.com> | 2012-06-13 15:47:16 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-06-13 15:47:16 +0000 |
commit | 49c4e619f81a66545e2332dc218d9bf31bbb51ad (patch) | |
tree | 7eb2c5e41613a35d7030005bbc19bb23414065ed /gdb/python | |
parent | 625e8578d7514d65901421467d2b6f0f5d87f634 (diff) | |
download | gdb-49c4e619f81a66545e2332dc218d9bf31bbb51ad.zip gdb-49c4e619f81a66545e2332dc218d9bf31bbb51ad.tar.gz gdb-49c4e619f81a66545e2332dc218d9bf31bbb51ad.tar.bz2 |
* ada-lang.c (ada_make_symbol_completion_list): Return a VEC.
* breakpoint.c (catch_syscall_completer): Return a VEC.
* cli/cli-cmds.c (complete_command): Update.
* cli/cli-decode.c (complete_on_cmdlist): Return a VEC.
(complete_on_enum): Likewise.
* command.h: Include gdb_vecs.h.
(completer_ftype): Change return type.
(complete_on_cmdlist, complete_on_enum): Likewise.
* completer.c (noop_completer, filename_completer)
(location_completer): Return a VEC.
(add_struct_fields): Remove 'nextp' argument. Change 'output'
to a VEC.
(expression_completer, complete_line_internal, complete_line)
(command_completer): Return a VEC.
(gdb_completion_word_break_characters, line_completion_function):
Update.
* completer.h: Include gdb_vecs.h.
(complete_line, noop_completer, filename_completer)
(expression_completer, location_completer, command_completer):
Update.
* f-lang.c (f_word_break_characters): Return a VEC.
* interps.c (interpreter_completer): Return a VEC.
* language.h (struct language_defn)
<la_make_symbol_completion_list>: Return a VEC.
* python/py-cmd.c (cmdpy_completer): Return a VEC.
* symtab.c (free_completion_list): Take a VEC.
(return_val_size, return_val_index): Remove.
(return_val): Now a VEC.
(completion_list_add_name): Update.
(default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_list_fn, make_file_symbol_completion_list):
Return a VEC.
(add_filename_to_list): Update.
(struct add_partial_filename_data) <list_used, list_alloced>: Remove.
<list>: Now a VEC.
(maybe_add_partial_symtab_filename): Update.
(make_source_files_completion_list): Return a VEC.
* symtab.h (default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_list_fn, make_file_symbol_completion_list)
(make_source_files_completion_list): Update.
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/py-cmd.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c index 605c8c0..d8e375c 100644 --- a/gdb/python/py-cmd.c +++ b/gdb/python/py-cmd.c @@ -206,12 +206,12 @@ cmdpy_function (struct cmd_list_element *command, char *args, int from_tty) /* Called by gdb for command completion. */ -static char ** +static VEC (char_ptr) * cmdpy_completer (struct cmd_list_element *command, char *text, char *word) { cmdpy_object *obj = (cmdpy_object *) get_cmd_context (command); PyObject *textobj, *wordobj, *resultobj = NULL; - char **result = NULL; + VEC (char_ptr) *result = NULL; struct cleanup *cleanup; cleanup = ensure_python_env (get_current_arch (), current_language); @@ -253,10 +253,10 @@ cmdpy_completer (struct cmd_list_element *command, char *text, char *word) if (len < 0) goto done; - result = (char **) xmalloc ((len + 1) * sizeof (char *)); for (i = out = 0; i < len; ++i) { PyObject *elt = PySequence_GetItem (resultobj, i); + char *item; if (elt == NULL || ! gdbpy_is_string (elt)) { @@ -264,16 +264,15 @@ cmdpy_completer (struct cmd_list_element *command, char *text, char *word) PyErr_Clear (); continue; } - result[out] = python_string_to_host_string (elt); - if (result[out] == NULL) + item = python_string_to_host_string (elt); + if (item == NULL) { /* Skip problem elements. */ PyErr_Clear (); continue; } - ++out; + VEC_safe_push (char_ptr, result, item); } - result[out] = NULL; } else if (PyInt_Check (resultobj)) { |