Skip to content

Commit 2155ae5

Browse files
committed
Use "do { } while (0)" to ensure requiring ";"
1 parent ced7b20 commit 2155ae5

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ext/fiddle/function.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ VALUE cFiddleFunction;
1919
#define Check_Max_Args_Long(name, len) \
2020
Check_Max_Args_(name, len, "l")
2121
#define Check_Max_Args_(name, len, fmt) \
22-
if ((size_t)(len) < MAX_ARGS) { \
23-
/* OK */ \
24-
} \
25-
else { \
26-
rb_raise(rb_eTypeError, \
27-
name" is so large that it can cause integer overflow (%"fmt"d)", \
28-
(len)); \
29-
}
22+
do { \
23+
if ((size_t)(len) >= MAX_ARGS) { \
24+
rb_raise(rb_eTypeError, \
25+
"%s is so large " \
26+
"that it can cause integer overflow (%"fmt"d)", \
27+
(name), (len)); \
28+
} \
29+
} while (0)
3030

3131
static void
3232
deallocate(void *p)

0 commit comments

Comments
 (0)