Rearrange switches so default cases are last

This commit is contained in:
Rangi42
2024-09-01 13:00:04 -04:00
parent 6b8d33529e
commit a098213053
3 changed files with 24 additions and 24 deletions

View File

@@ -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;