aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2017-11-15 09:22:48 -0500
committerSimon Marchi <simon.marchi@ericsson.com>2017-11-15 11:08:53 -0500
commit625ad4406d301f670b823a7767528f3ba7e292c6 (patch)
treefa43ec377db53cabdb78266ae9dc0edbd758b934
parent71774bc994e3f2a09c3b1988dbf2e99b86f53e2e (diff)
downloadgdb-625ad4406d301f670b823a7767528f3ba7e292c6.zip
gdb-625ad4406d301f670b823a7767528f3ba7e292c6.tar.gz
gdb-625ad4406d301f670b823a7767528f3ba7e292c6.tar.bz2
tui-win: Replace VEC with std::vector
This patch replaces an instance of VEC (const_char_ptr) with std::vector<const char *>. Tested by running gdb.tui/completion.exp, which exercises this function. gdb/ChangeLog: * tui/tui-win.c (window_name_completer): Replace VEC with std::vector.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/tui/tui-win.c21
2 files changed, 14 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5105df6..9b1c335 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-15 Simon Marchi <simon.marchi@ericsson.com>
+
+ * tui/tui-win.c (window_name_completer): Replace VEC with
+ std::vector.
+
2017-11-15 Andrew Cagney <cagney@gnu.org>
* MAINTAINERS: Remove no-longer applicable entries.
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index cbeff1f..3694a22 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -365,7 +365,7 @@ window_name_completer (completion_tracker &tracker,
int include_next_prev_p,
const char *text, const char *word)
{
- VEC (const_char_ptr) *completion_name_vec = NULL;
+ std::vector<const char *> completion_name_vec;
int win_type;
for (win_type = SRC_WIN; win_type < MAX_MAJOR_WINDOWS; win_type++)
@@ -379,31 +379,28 @@ window_name_completer (completion_tracker &tracker,
completion_name = tui_win_name (&tui_win_list [win_type]->generic);
gdb_assert (completion_name != NULL);
- VEC_safe_push (const_char_ptr, completion_name_vec, completion_name);
+ completion_name_vec.push_back (completion_name);
}
/* If no windows are considered visible then the TUI has not yet been
initialized. But still "focus src" and "focus cmd" will work because
invoking the focus command will entail initializing the TUI which sets the
default layout to SRC_COMMAND. */
- if (VEC_length (const_char_ptr, completion_name_vec) == 0)
+ if (completion_name_vec.empty ())
{
- VEC_safe_push (const_char_ptr, completion_name_vec, SRC_NAME);
- VEC_safe_push (const_char_ptr, completion_name_vec, CMD_NAME);
+ completion_name_vec.push_back (SRC_NAME);
+ completion_name_vec.push_back (CMD_NAME);
}
if (include_next_prev_p)
{
- VEC_safe_push (const_char_ptr, completion_name_vec, "next");
- VEC_safe_push (const_char_ptr, completion_name_vec, "prev");
+ completion_name_vec.push_back ("next");
+ completion_name_vec.push_back ("prev");
}
- VEC_safe_push (const_char_ptr, completion_name_vec, NULL);
- complete_on_enum (tracker,
- VEC_address (const_char_ptr, completion_name_vec),
- text, word);
- VEC_free (const_char_ptr, completion_name_vec);
+ completion_name_vec.push_back (NULL);
+ complete_on_enum (tracker, completion_name_vec.data (), text, word);
}
/* Complete possible window names to focus on. TEXT is the complete text