From 197f6cb0ba2babcccc63e3710d3e97e527232d02 Mon Sep 17 00:00:00 2001 From: Sylvie <35663410+Rangi42@users.noreply.github.com> Date: Wed, 18 Sep 2024 06:23:05 -0400 Subject: [PATCH] No need for `.c_str()` with `keywordDict` lookups (#1505) --- src/asm/lexer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/asm/lexer.cpp b/src/asm/lexer.cpp index b629349f..2619dcbf 100644 --- a/src/asm/lexer.cpp +++ b/src/asm/lexer.cpp @@ -1170,7 +1170,7 @@ static Token readIdentifier(char firstChar, bool raw) { // Attempt to check for a keyword if the identifier is not raw if (!raw) { - if (auto search = keywordDict.find(identifier.c_str()); search != keywordDict.end()) + if (auto search = keywordDict.find(identifier); search != keywordDict.end()) return Token(search->second); } @@ -1231,7 +1231,7 @@ static std::shared_ptr readInterpolation(size_t depth) { if (fmtBuf.starts_with('#')) { // Skip a '#' raw identifier prefix, but after expanding any nested interpolations. fmtBuf.erase(0, 1); - } else if (keywordDict.find(fmtBuf.c_str()) != keywordDict.end()) { + } else if (keywordDict.find(fmtBuf) != keywordDict.end()) { // Don't allow symbols that alias keywords without a '#' prefix. error( "Interpolated symbol \"%s\" is a reserved keyword; add a '#' prefix to use it as a raw "