From 055eacd032d80f9359f1a05afe48d126bb5ccd3b Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 20 Apr 2014 11:27:59 +0100 Subject: [PATCH] use StringView for parse_keys --- src/keys.cc | 4 ++-- src/keys.hh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/keys.cc b/src/keys.cc index e3b2f111e..f21f93ec6 100644 --- a/src/keys.cc +++ b/src/keys.cc @@ -36,7 +36,7 @@ static const KeyAndName keynamemap[] = { { "backtab", Key::BackTab }, }; -KeyList parse_keys(const String& str) +KeyList parse_keys(StringView str) { KeyList result; for (ByteCount pos = 0; pos < str.length(); ++pos) @@ -51,7 +51,7 @@ KeyList parse_keys(const String& str) { Key::Modifiers modifier = Key::Modifiers::None; - String keyname = str.substr(pos+1, end_pos - pos - 1); + auto keyname = str.substr(pos+1, end_pos - pos - 1); if (keyname.length() > 2) { if (tolower(keyname[0]) == 'c' and keyname[1] == '-') diff --git a/src/keys.hh b/src/keys.hh index de7755529..d64cee2eb 100644 --- a/src/keys.hh +++ b/src/keys.hh @@ -66,7 +66,7 @@ struct Key using KeyList = std::vector; -KeyList parse_keys(const String& str); +KeyList parse_keys(StringView str); String key_to_str(Key key); constexpr Key alt(Codepoint key) { return { Key::Modifiers::Alt, key }; }