mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Rearrange switches so default cases are last
This commit is contained in:
@@ -119,14 +119,6 @@ static std::string escapeString(std::string const &str) {
|
||||
for (char c : str) {
|
||||
// Escape characters that need escaping
|
||||
switch (c) {
|
||||
case '\\':
|
||||
case '"':
|
||||
case '{':
|
||||
escaped += '\\';
|
||||
[[fallthrough]];
|
||||
default:
|
||||
escaped += c;
|
||||
break;
|
||||
case '\n':
|
||||
escaped += "\\n";
|
||||
break;
|
||||
@@ -139,6 +131,14 @@ static std::string escapeString(std::string const &str) {
|
||||
case '\0':
|
||||
escaped += "\\0";
|
||||
break;
|
||||
case '\\':
|
||||
case '"':
|
||||
case '{':
|
||||
escaped += '\\';
|
||||
[[fallthrough]];
|
||||
default:
|
||||
escaped += c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return escaped;
|
||||
|
||||
Reference in New Issue
Block a user