Skip to content

Commit

Permalink
options/ansi: make {MATCH,EOF}_CHECK statement expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
64 committed Nov 29, 2024
1 parent d56ac8f commit 8a073a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions options/ansi/generic/stdio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ static void store_int(void *dest, unsigned int size, unsigned long long i) {

template<typename H>
static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) {
#define NOMATCH_CHECK(cond) if(cond) return match_count // if cond is true, matching error
#define EOF_CHECK(cond) if(cond) return match_count ? match_count : EOF // if cond is true, no more data to read
#define NOMATCH_CHECK(cond) ({ if(cond) return match_count; }) // if cond is true, matching error
#define EOF_CHECK(cond) ({ if(cond) return match_count ? match_count : EOF; }) // if cond is true, no more data to read
int match_count = 0;
for (; *fmt; fmt++) {
if (isspace(*fmt)) {
Expand Down

0 comments on commit 8a073a1

Please sign in to comment.