Skip to content

Commit

Permalink
Don't use while(0/1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Oct 23, 2020
1 parent a726f2d commit a4dd36c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/font/marked-up_text.cpp
Expand Up @@ -416,7 +416,7 @@ std::string word_wrap_text(const std::string& unwrapped_text, int font_size,
int style = TTF_STYLE_NORMAL;
utf8::iterator end = utf8::iterator::end(unwrapped_text);

while(1) {
while(true) {
if(start_of_line) {
line_width = 0;
format_string.clear();
Expand Down
2 changes: 1 addition & 1 deletion src/serialization/parser.cpp
Expand Up @@ -332,7 +332,7 @@ void parser::parse_variable()

bool ignore_next_newlines = false, previous_string = false;

while(1) {
while(true) {
tok_.next_token();
assert(curvar != variables.end());

Expand Down
2 changes: 1 addition & 1 deletion src/tracer.hpp
Expand Up @@ -100,4 +100,4 @@ struct tracer
#define TRACER_COUNT(marker) \
do { \
++tracer.counters[std::make_pair(__LINE__, marker)]; \
} while(0)
} while(false)
8 changes: 4 additions & 4 deletions src/wml_exception.hpp
Expand Up @@ -42,7 +42,7 @@
if(!(cond)) { \
throw_wml_exception(#cond, __FILE__, __LINE__, __func__, message); \
} \
} while(0)
} while(false)

#define VALIDATE_WITH_DEV_MESSAGE(cond, message, dev_message) \
do { \
Expand All @@ -54,12 +54,12 @@
, message \
, dev_message); \
} \
} while(0)
} while(false)

#define FAIL(message) \
do { \
throw_wml_exception(nullptr, __FILE__, __LINE__, __func__, message); \
} while(0)
} while(false)

#define FAIL_WITH_DEV_MESSAGE(message, dev_message) \
do { \
Expand All @@ -69,7 +69,7 @@
, __func__ \
, message \
, dev_message); \
} while(0)
} while(false)

/**
* Helper function, don't call this directly.
Expand Down

0 comments on commit a4dd36c

Please sign in to comment.