diff options
| author | Maxime Coste <mawww@kakoune.org> | 2019-03-19 22:00:57 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2019-03-19 22:00:57 +1100 |
| commit | 56611604b28b6c293b13e3637fbae65e6bea064c (patch) | |
| tree | 710d7c264d81ac352292cba196b231aca832afda /src/command_manager.cc | |
| parent | c2be661785418be87e06d366979bdcd8ff3cf0b2 (diff) | |
Make String able to reference external data without copying
Sometimes we really need to have a String instead of a StringView,
but some of those strings might not need to own their data. Make
it possible to explicitely construct a String that does not own
the underlying buffer.
Use it when parsing balanced strings.
Diffstat (limited to 'src/command_manager.cc')
| -rw-r--r-- | src/command_manager.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/command_manager.cc b/src/command_manager.cc index 42e7f802..f777eeda 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -121,11 +121,11 @@ QuotedResult parse_quoted_balanced(Reader& reader, char opening_delimiter, { auto content = reader.substr_from(start); ++reader.pos; - return {content.str(), true}; + return {String{String::NoCopy{}, content}, true}; } ++reader.pos; } - return {reader.substr_from(start).str(), false}; + return {String{String::NoCopy{}, reader.substr_from(start)}, false}; } String parse_unquoted(Reader& reader) |
