Skip to content

Commit

Permalink
Prefer empty braces to semicolons for empty loop bodies
Browse files Browse the repository at this point in the history
  • Loading branch information
Rangi42 committed Jan 17, 2025
1 parent a85d6b3 commit fac5e35
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/asm/charmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ bool charmap_HasChar(std::string const &input) {

std::vector<int32_t> charmap_Convert(std::string const &input) {
std::vector<int32_t> output;
for (std::string_view inputView = input; charmap_ConvertNext(inputView, &output);)
;
for (std::string_view inputView = input; charmap_ConvertNext(inputView, &output);) {}
return output;
}

Expand Down
3 changes: 1 addition & 2 deletions src/asm/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -2577,8 +2577,7 @@ static size_t charlenUTF8(std::string const &str) {
std::string_view view = str;
size_t len;

for (len = 0; charmap_ConvertNext(view, nullptr); len++)
;
for (len = 0; charmap_ConvertNext(view, nullptr); len++) {}

return len;
}
Expand Down
9 changes: 3 additions & 6 deletions src/link/patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ static int32_t computeRPNExpr(Patch const &patch, std::vector<Symbol> const &fil
// `expression` is not guaranteed to be '\0'-terminated. If it is not,
// `getRPNByte` will have a fatal internal error.
char const *name = reinterpret_cast<char const *>(expression);
while (getRPNByte(expression, size, patch))
;
while (getRPNByte(expression, size, patch)) {}

if (Section const *sect = sect_GetSection(name); !sect) {
error(
Expand Down Expand Up @@ -281,8 +280,7 @@ static int32_t computeRPNExpr(Patch const &patch, std::vector<Symbol> const &fil
case RPN_SIZEOF_SECT: {
// This has assumptions commented in the `RPN_BANK_SECT` case above.
char const *name = reinterpret_cast<char const *>(expression);
while (getRPNByte(expression, size, patch))
;
while (getRPNByte(expression, size, patch)) {}

if (Section const *sect = sect_GetSection(name); !sect) {
error(
Expand All @@ -302,8 +300,7 @@ static int32_t computeRPNExpr(Patch const &patch, std::vector<Symbol> const &fil
case RPN_STARTOF_SECT: {
// This has assumptions commented in the `RPN_BANK_SECT` case above.
char const *name = reinterpret_cast<char const *>(expression);
while (getRPNByte(expression, size, patch))
;
while (getRPNByte(expression, size, patch)) {}

if (Section const *sect = sect_GetSection(name); !sect) {
error(
Expand Down

0 comments on commit fac5e35

Please sign in to comment.