std::vector<wcstring> is wcstring_list_t

This commit is contained in:
Aaron Gyes 2019-03-14 11:15:50 -07:00
parent 0ee9862809
commit 477b2e8d7c
10 changed files with 11 additions and 12 deletions

View File

@ -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<wcstring> ecmds;
wcstring_list_t ecmds;
wcstring sets_mode;
if (!input_mapping_get(seq, bind_mode, &ecmds, user, &sets_mode)) {

View File

@ -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<wcstring> backtrace_text;
wcstring_list_t backtrace_text;
if (skip_levels + max_frames < n_frames) n_frames = skip_levels + max_frames;

View File

@ -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<wcstring> &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);

View File

@ -23,7 +23,7 @@ bool exec_job(parser_t &parser, std::shared_ptr<job_t> 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<wcstring> &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);

View File

@ -3012,10 +3012,10 @@ static void test_line_iterator() {
do_test((lines1 == std::vector<std::string>{"Alpha", "Beta", "Gamma", "", "Delta"}));
wcstring text2 = L"\n\nAlpha\nBeta\nGamma\n\nDelta";
std::vector<wcstring> lines2;
wcstring_list_t lines2;
line_iterator_t<wcstring> iter2(text2);
while (iter2.next()) lines2.push_back(iter2.line());
do_test((lines2 == std::vector<wcstring>{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

View File

@ -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<wcstring> pathsv =
wcstring_list_t pathsv =
cdpath.missing_or_empty() ? wcstring_list_t{L"."} : cdpath->as_list();
for (auto next_path : pathsv) {

View File

@ -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<wcstring> 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;

View File

@ -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<wcstring> pathsv;
wcstring_list_t pathsv;
if (path_var) path_var->to_list(pathsv);
for (auto path : pathsv) {
if (path.empty()) continue;

View File

@ -196,7 +196,7 @@ class reader_history_search_t {
tokenizer_t tok(text.c_str(), TOK_ACCEPT_UNFINISHED);
tok_t token;
std::vector<wcstring> local_tokens;
wcstring_list_t local_tokens;
while (tok.next(&token)) {
if (token.type != TOK_STRING) continue;
wcstring text = tok.text_of(token);

View File

@ -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<wcstring> 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.