diff options
author | Keith Seitz <keiths@redhat.com> | 2017-08-17 13:58:01 -0700 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2017-08-17 13:58:01 -0700 |
commit | b5f28d7abc02ca509e389fa932d725cf111e4b40 (patch) | |
tree | 57a0dc0feaff890630a6ba2c9fab811d56b1f9cf /gdb/guile/scm-cmd.c | |
parent | 2a95a158fae932f758d75a1178a40d4cc4804ff0 (diff) | |
parent | 1a457753cfad05989574c671a221ffce2d5df703 (diff) | |
download | binutils-users/pmuldoon/c++compile.zip binutils-users/pmuldoon/c++compile.tar.gz binutils-users/pmuldoon/c++compile.tar.bz2 |
Update w/HEADusers/pmuldoon/c++compile
Problems:
gdb/compile/compile.c
gdb/cp-support.c
gdb/cp-support.h
gdb/gdbtypes.h
gdb/language.c
gdb/linespec.c
Diffstat (limited to 'gdb/guile/scm-cmd.c')
-rw-r--r-- | gdb/guile/scm-cmd.c | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c index ae5d145..5501d31 100644 --- a/gdb/guile/scm-cmd.c +++ b/gdb/guile/scm-cmd.c @@ -114,7 +114,7 @@ static const struct cmdscm_completer cmdscm_completers[] = { "COMPLETE_FILENAME", filename_completer }, { "COMPLETE_LOCATION", location_completer }, { "COMPLETE_COMMAND", command_completer }, - { "COMPLETE_SYMBOL", make_symbol_completion_list_fn }, + { "COMPLETE_SYMBOL", symbol_completer }, { "COMPLETE_EXPRESSION", expression_completer }, }; @@ -350,9 +350,8 @@ cmdscm_bad_completion_result (const char *msg, SCM completion) The result is a boolean indicating success. */ static int -cmdscm_add_completion (SCM completion, VEC (char_ptr) **result) +cmdscm_add_completion (SCM completion, completion_tracker &tracker) { - char *item; SCM except_scm; if (!scm_is_string (completion)) @@ -363,8 +362,9 @@ cmdscm_add_completion (SCM completion, VEC (char_ptr) **result) return 0; } - item = gdbscm_scm_to_string (completion, NULL, host_charset (), 1, - &except_scm); + gdb::unique_xmalloc_ptr<char> item + (gdbscm_scm_to_string (completion, NULL, host_charset (), 1, + &except_scm)); if (item == NULL) { /* Inform the user, but otherwise ignore the entire result. */ @@ -372,21 +372,21 @@ cmdscm_add_completion (SCM completion, VEC (char_ptr) **result) return 0; } - VEC_safe_push (char_ptr, *result, item); + tracker.add_completion (std::move (item)); return 1; } /* Called by gdb for command completion. */ -static VEC (char_ptr) * +static void cmdscm_completer (struct cmd_list_element *command, + completion_tracker &tracker, const char *text, const char *word) { 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)); @@ -408,7 +408,7 @@ cmdscm_completer (struct cmd_list_element *command, { /* 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))) @@ -419,11 +419,8 @@ cmdscm_completer (struct cmd_list_element *command, { SCM next = scm_car (list); - if (!cmdscm_add_completion (next, &result)) - { - VEC_free (char_ptr, result); - goto done; - } + if (!cmdscm_add_completion (next, tracker)) + break; list = scm_cdr (list); } @@ -437,17 +434,13 @@ cmdscm_completer (struct cmd_list_element *command, { if (gdbscm_is_exception (next)) { - /* Inform the user, but otherwise ignore the entire result. */ + /* Inform the user. */ gdbscm_print_gdb_exception (SCM_BOOL_F, completer_result_scm); - VEC_free (char_ptr, result); - goto done; + break; } - if (!cmdscm_add_completion (next, &result)) - { - VEC_free (char_ptr, result); - goto done; - } + if (cmdscm_add_completion (next, tracker)) + break; next = itscm_safe_call_next_x (iter, NULL); } @@ -458,9 +451,6 @@ cmdscm_completer (struct cmd_list_element *command, 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 |