diff --git a/builtin.cpp b/builtin.cpp index 401f4c0cd..4eb88ba1a 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -142,7 +142,7 @@ struct io_stack_elem_t { wcstring out; wcstring err; }; -static std::stack io_stack; +static std::stack > io_stack; /** The file from which builtin functions should attempt to read, use diff --git a/fish_tests.cpp b/fish_tests.cpp index 917da8786..e682acdb7 100644 --- a/fish_tests.cpp +++ b/fish_tests.cpp @@ -964,7 +964,7 @@ void history_tests_t::test_history(void) { path_list_t paths; size_t count = rand() % 6; while (count--) { - paths.push_front(random_string()); + paths.push_back(random_string()); } /* Record this item */ diff --git a/history.cpp b/history.cpp index 902cb58d1..fd7b328f1 100644 --- a/history.cpp +++ b/history.cpp @@ -637,13 +637,11 @@ history_item_t history_t::decode_item_fish_2_0(const char *base, size_t len) { /* Skip the leading dash-space and then store this path it */ line.erase(0, 2); unescape_yaml(line); - paths.push_front(str2wcstring(line)); + paths.push_back(str2wcstring(line)); } } } - /* Reverse the paths, since we pushed them to the front each time */ done: - paths.reverse(); return history_item_t(cmd, when, paths); } @@ -1243,7 +1241,7 @@ int file_detection_context_t::perform_file_detection(bool test_all) { for (path_list_t::const_iterator iter = potential_paths.begin(); iter != potential_paths.end(); ++iter) { if (path_is_valid(*iter, working_directory)) { /* Push the original (possibly relative) path */ - valid_paths.push_front(*iter); + valid_paths.push_back(*iter); } else { /* Not a valid path */ result = 0; @@ -1251,7 +1249,6 @@ int file_detection_context_t::perform_file_detection(bool test_all) { break; } } - valid_paths.reverse(); return result; } @@ -1305,7 +1302,7 @@ void history_t::add_with_file_detection(const wcstring &str) if (token_cstr) { wcstring potential_path = token_cstr; if (unescape_string(potential_path, false) && string_could_be_path(potential_path)) { - potential_paths.push_front(potential_path); + potential_paths.push_back(potential_path); } } } @@ -1317,7 +1314,6 @@ void history_t::add_with_file_detection(const wcstring &str) file_detection_context_t *context = new file_detection_context_t(this, str); /* Store the potential paths. Reverse them to put them in the same order as in the command. */ - potential_paths.reverse(); context->potential_paths.swap(potential_paths); iothread_perform(threaded_perform_file_detection, perform_file_detection_done, context); } diff --git a/history.h b/history.h index fe700f42c..9bfb2a516 100644 --- a/history.h +++ b/history.h @@ -11,10 +11,9 @@ #include #include #include -#include #include -typedef std::list path_list_t; +typedef std::vector path_list_t; enum history_search_type_t { /** The history searches for strings containing the given string */ diff --git a/reader.cpp b/reader.cpp index c32a65edc..94ad22bf6 100644 --- a/reader.cpp +++ b/reader.cpp @@ -345,7 +345,7 @@ static int is_interactive_read; static int end_loop = 0; /** The stack containing names of files that are being parsed */ -static std::stack > current_filename; +static std::stack > current_filename; /**