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

@@ -360,14 +360,6 @@ static void dumpString(std::string const &escape, FILE *file) {
for (char c : escape) {
// Escape characters that need escaping
switch (c) {
case '\\':
case '"':
case '{':
putc('\\', file);
[[fallthrough]];
default:
putc(c, file);
break;
case '\n':
fputs("\\n", file);
break;
@@ -380,6 +372,14 @@ static void dumpString(std::string const &escape, FILE *file) {
case '\0':
fputs("\\0", file);
break;
case '\\':
case '"':
case '{':
putc('\\', file);
[[fallthrough]];
default:
putc(c, file);
break;
}
}
}