Skip to content

Commit

Permalink
Use "do { } while (0)" to ensure requiring ";"
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jun 26, 2020
1 parent ced7b20 commit 2155ae5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ext/fiddle/function.c
Expand Up @@ -19,14 +19,14 @@ VALUE cFiddleFunction;
#define Check_Max_Args_Long(name, len) \
Check_Max_Args_(name, len, "l")
#define Check_Max_Args_(name, len, fmt) \
if ((size_t)(len) < MAX_ARGS) { \
/* OK */ \
} \
else { \
rb_raise(rb_eTypeError, \
name" is so large that it can cause integer overflow (%"fmt"d)", \
(len)); \
}
do { \
if ((size_t)(len) >= MAX_ARGS) { \
rb_raise(rb_eTypeError, \
"%s is so large " \
"that it can cause integer overflow (%"fmt"d)", \
(name), (len)); \
} \
} while (0)

static void
deallocate(void *p)
Expand Down

0 comments on commit 2155ae5

Please sign in to comment.