mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 13:39:02 +00:00
Switch from std::list to std::vector in a few places to reduce compiled code size
This commit is contained in:
parent
eba75dbc2e
commit
62c49f13ce
5 changed files with 7 additions and 12 deletions
|
@ -142,7 +142,7 @@ struct io_stack_elem_t {
|
|||
wcstring out;
|
||||
wcstring err;
|
||||
};
|
||||
static std::stack<io_stack_elem_t> io_stack;
|
||||
static std::stack<io_stack_elem_t, std::vector<io_stack_elem_t> > io_stack;
|
||||
|
||||
/**
|
||||
The file from which builtin functions should attempt to read, use
|
||||
|
|
|
@ -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 */
|
||||
|
|
10
history.cpp
10
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);
|
||||
}
|
||||
|
|
|
@ -11,10 +11,9 @@
|
|||
#include <vector>
|
||||
#include <utility>
|
||||
#include <list>
|
||||
#include <tr1/memory>
|
||||
#include <set>
|
||||
|
||||
typedef std::list<wcstring> path_list_t;
|
||||
typedef std::vector<wcstring> path_list_t;
|
||||
|
||||
enum history_search_type_t {
|
||||
/** The history searches for strings containing the given string */
|
||||
|
|
|
@ -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<const wchar_t *, std::list<const wchar_t *> > current_filename;
|
||||
static std::stack<const wchar_t *, std::vector<const wchar_t *> > current_filename;
|
||||
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue