aboutsummaryrefslogtreecommitdiffhomepage
path: root/highlight.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-07-20 20:39:31 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-07-20 20:39:31 -0700
commitb08fb866378693d2e75f17fdfe5e60401a29136a (patch)
treead1eb00129b96d284ab9ed4ca2de1cc176219777 /highlight.cpp
parentb290fd33b973e573ffc7fc0c87be3ab431678b5f (diff)
Renamed env_vars to env_vars_snapshot_t
Cleanup of non-wcstring version of path_get_path
Diffstat (limited to 'highlight.cpp')
-rw-r--r--highlight.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/highlight.cpp b/highlight.cpp
index 75d9f8db..57068b1a 100644
--- a/highlight.cpp
+++ b/highlight.cpp
@@ -828,7 +828,7 @@ bool autosuggest_suggest_special(const wcstring &str, const wcstring &working_di
return result;
}
-bool autosuggest_validate_from_history(const history_item_t &item, file_detection_context_t &detector, const wcstring &working_directory, const env_vars &vars) {
+bool autosuggest_validate_from_history(const history_item_t &item, file_detection_context_t &detector, const wcstring &working_directory, const env_vars_snapshot_t &vars) {
ASSERT_IS_BACKGROUND_THREAD();
bool handled = false, suggestionOK = false;
@@ -868,12 +868,12 @@ bool autosuggest_validate_from_history(const history_item_t &item, file_detectio
if (! handled) {
bool cmd_ok = false;
- wchar_t *full_path = path_get_path(parsed_command.c_str());
- if (full_path) {
+ if (path_get_path(parsed_command, NULL))
+ {
cmd_ok = true;
- free(full_path);
}
- else if (builtin_exists(parsed_command) || function_exists_no_autoload(parsed_command, vars)) {
+ else if (builtin_exists(parsed_command) || function_exists_no_autoload(parsed_command, vars))
+ {
cmd_ok = true;
}
@@ -893,7 +893,7 @@ bool autosuggest_validate_from_history(const history_item_t &item, file_detectio
}
// This function does I/O
-static void tokenize( const wchar_t * const buff, std::vector<int> &color, const int pos, wcstring_list_t *error, const wcstring &working_directory, const env_vars &vars) {
+static void tokenize( const wchar_t * const buff, std::vector<int> &color, const int pos, wcstring_list_t *error, const wcstring &working_directory, const env_vars_snapshot_t &vars) {
ASSERT_IS_BACKGROUND_THREAD();
wcstring cmd;
@@ -1077,8 +1077,7 @@ static void tokenize( const wchar_t * const buff, std::vector<int> &color, const
*/
if (! is_cmd && use_command )
{
- wcstring tmp;
- is_cmd = path_get_path_string( cmd, tmp, vars );
+ is_cmd = path_get_path( cmd, NULL, vars );
}
/* Maybe it is a path for a implicit cd command. */
@@ -1267,7 +1266,7 @@ static void tokenize( const wchar_t * const buff, std::vector<int> &color, const
// PCA This function does I/O, (calls is_potential_path, path_get_path, maybe others) and so ought to only run on a background thread
-void highlight_shell( const wcstring &buff, std::vector<int> &color, int pos, wcstring_list_t *error, const env_vars &vars )
+void highlight_shell( const wcstring &buff, std::vector<int> &color, int pos, wcstring_list_t *error, const env_vars_snapshot_t &vars )
{
ASSERT_IS_BACKGROUND_THREAD();
@@ -1500,7 +1499,7 @@ static void highlight_universal_internal( const wcstring &buffstr,
}
}
-void highlight_universal( const wcstring &buff, std::vector<int> &color, int pos, wcstring_list_t *error, const env_vars &vars )
+void highlight_universal( const wcstring &buff, std::vector<int> &color, int pos, wcstring_list_t *error, const env_vars_snapshot_t &vars )
{
assert(buff.size() == color.size());
std::fill(color.begin(), color.end(), 0);