From 477b2e8d7c21c93f7ae544af82ad51a818040dbf Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Thu, 14 Mar 2019 11:15:50 -0700 Subject: [PATCH] std::vector is wcstring_list_t --- src/builtin_bind.cpp | 2 +- src/common.cpp | 2 +- src/exec.cpp | 2 +- src/exec.h | 2 +- src/fish_tests.cpp | 4 ++-- src/highlight.cpp | 2 +- src/input.cpp | 3 +-- src/path.cpp | 2 +- src/reader.cpp | 2 +- src/screen.h | 2 +- 10 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/builtin_bind.cpp b/src/builtin_bind.cpp index 533d48399..dbf717347 100644 --- a/src/builtin_bind.cpp +++ b/src/builtin_bind.cpp @@ -53,7 +53,7 @@ struct bind_cmd_opts_t { /// Returns false if no binding with that sequence and mode exists. bool builtin_bind_t::list_one(const wcstring &seq, const wcstring &bind_mode, bool user, io_streams_t &streams) { - std::vector ecmds; + wcstring_list_t ecmds; wcstring sets_mode; if (!input_mapping_get(seq, bind_mode, &ecmds, user, &sets_mode)) { diff --git a/src/common.cpp b/src/common.cpp index de0759a5a..41d7ee3e0 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -198,7 +198,7 @@ demangled_backtrace(int max_frames, int skip_levels) { int n_frames = backtrace(callstack, n_max_frames); char **symbols = backtrace_symbols(callstack, n_frames); wchar_t text[1024]; - std::vector backtrace_text; + wcstring_list_t backtrace_text; if (skip_levels + max_frames < n_frames) n_frames = skip_levels + max_frames; diff --git a/src/exec.cpp b/src/exec.cpp index 05ebea52a..b93c78f02 100644 --- a/src/exec.cpp +++ b/src/exec.cpp @@ -1150,7 +1150,7 @@ static int exec_subshell_internal(const wcstring &cmd, parser_t &parser, wcstrin return subcommand_statuses.status; } -int exec_subshell(const wcstring &cmd, parser_t &parser, std::vector &outputs, +int exec_subshell(const wcstring &cmd, parser_t &parser, wcstring_list_t &outputs, bool apply_exit_status, bool is_subcmd) { ASSERT_IS_MAIN_THREAD(); return exec_subshell_internal(cmd, parser, &outputs, apply_exit_status, is_subcmd); diff --git a/src/exec.h b/src/exec.h index 63b78abc7..12c5d9051 100644 --- a/src/exec.h +++ b/src/exec.h @@ -23,7 +23,7 @@ bool exec_job(parser_t &parser, std::shared_ptr j); /// \param outputs The list to insert output into. /// /// \return the status of the last job to exit, or -1 if en error was encountered. -int exec_subshell(const wcstring &cmd, parser_t &parser, std::vector &outputs, +int exec_subshell(const wcstring &cmd, parser_t &parser, wcstring_list_t &outputs, bool preserve_exit_status, bool is_subcmd = false); int exec_subshell(const wcstring &cmd, parser_t &parser, bool preserve_exit_status, bool is_subcmd = false); diff --git a/src/fish_tests.cpp b/src/fish_tests.cpp index e459dc504..217753c82 100644 --- a/src/fish_tests.cpp +++ b/src/fish_tests.cpp @@ -3012,10 +3012,10 @@ static void test_line_iterator() { do_test((lines1 == std::vector{"Alpha", "Beta", "Gamma", "", "Delta"})); wcstring text2 = L"\n\nAlpha\nBeta\nGamma\n\nDelta"; - std::vector lines2; + wcstring_list_t lines2; line_iterator_t iter2(text2); while (iter2.next()) lines2.push_back(iter2.line()); - do_test((lines2 == std::vector{L"", L"", L"Alpha", L"Beta", L"Gamma", L"", L"Delta"})); + do_test((lines2 == wcstring_list_t{L"", L"", L"Alpha", L"Beta", L"Gamma", L"", L"Delta"})); } #define UVARS_PER_THREAD 8 diff --git a/src/highlight.cpp b/src/highlight.cpp index d45426024..bea5a6dc5 100644 --- a/src/highlight.cpp +++ b/src/highlight.cpp @@ -322,7 +322,7 @@ static bool is_potential_cd_path(const wcstring &path, const wcstring &working_d } else { // Get the CDPATH. auto cdpath = vars.get(L"CDPATH"); - std::vector pathsv = + wcstring_list_t pathsv = cdpath.missing_or_empty() ? wcstring_list_t{L"."} : cdpath->as_list(); for (auto next_path : pathsv) { diff --git a/src/input.cpp b/src/input.cpp index 66205a628..5cece3eeb 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -46,8 +46,7 @@ struct input_mapping_t { /// New mode that should be switched to after command evaluation. wcstring sets_mode; - input_mapping_t(wcstring s, std::vector c, wcstring m, - wcstring sm) + input_mapping_t(wcstring s, wcstring_list_t c, wcstring m, wcstring sm) : seq(std::move(s)), commands(std::move(c)), mode(std::move(m)), sets_mode(std::move(sm)) { static unsigned int s_last_input_map_spec_order = 0; specification_order = ++s_last_input_map_spec_order; diff --git a/src/path.cpp b/src/path.cpp index 93d941204..8349dd50e 100644 --- a/src/path.cpp +++ b/src/path.cpp @@ -135,7 +135,7 @@ wcstring_list_t path_get_paths(const wcstring &cmd, const environment_t &vars) { } auto path_var = vars.get(L"PATH"); - std::vector pathsv; + wcstring_list_t pathsv; if (path_var) path_var->to_list(pathsv); for (auto path : pathsv) { if (path.empty()) continue; diff --git a/src/reader.cpp b/src/reader.cpp index 8d2b0ec35..02c5a11bc 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -196,7 +196,7 @@ class reader_history_search_t { tokenizer_t tok(text.c_str(), TOK_ACCEPT_UNFINISHED); tok_t token; - std::vector local_tokens; + wcstring_list_t local_tokens; while (tok.next(&token)) { if (token.type != TOK_STRING) continue; wcstring text = tok.text_of(token); diff --git a/src/screen.h b/src/screen.h index d44e40457..a88d9d4ef 100644 --- a/src/screen.h +++ b/src/screen.h @@ -222,7 +222,7 @@ class layout_cache_t { private: // Cached escape sequences we've already detected in the prompt and similar strings, ordered // lexicographically. - std::vector esc_cache_; + wcstring_list_t esc_cache_; // LRU-list of prompts and their layouts. // Use a list so we can promote to the front on a cache hit.