mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-15 22:44:01 +00:00
Make escape_yaml_fish_2_0 and unescape_yaml_fish_2_0 static
They no longer need to be exposed.
This commit is contained in:
parent
3ae5b23971
commit
ce178fd6fd
2 changed files with 3 additions and 6 deletions
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue