diff --git a/src/history_file.cpp b/src/history_file.cpp index b1e00b6f7..c21adc490 100644 --- a/src/history_file.cpp +++ b/src/history_file.cpp @@ -68,13 +68,14 @@ static void replace_all(std::string *str, const char *needle, const char *replac } } -void escape_yaml_fish_2_0(std::string *str) { +// Support for escaping and unescaping the nonstandard "yaml" format introduced in fish 2.0. +static void escape_yaml_fish_2_0(std::string *str) { replace_all(str, "\\", "\\\\"); // replace one backslash with two replace_all(str, "\n", "\\n"); // replace newline with backslash + literal n } /// This function is called frequently, so it ought to be fast. -void unescape_yaml_fish_2_0(std::string *str) { +static void unescape_yaml_fish_2_0(std::string *str) { size_t cursor = 0, size = str->size(); while (cursor < size) { // Operate on a const version of str, to avoid needless COWs that at() does. diff --git a/src/history_file.h b/src/history_file.h index bc0065099..a86fecf97 100644 --- a/src/history_file.h +++ b/src/history_file.h @@ -70,8 +70,4 @@ class history_file_contents_t { /// Append a history item to a buffer, in preparation for outputting it to the history file. void append_history_item_to_buffer(const history_item_t &item, std::string *buffer); -// Support for escaping and unescaping the nonstandard "yaml" format introduced in fish 2.0. -void escape_yaml_fish_2_0(std::string *str); -void unescape_yaml_fish_2_0(std::string *str); - #endif