ruby-changes:61959
From: Sutou <ko1@a...>
Date: Sun, 28 Jun 2020 02:03:04 +0900 (JST)
Subject: [ruby-changes:61959] 50fbd00e76 (master): [ruby/fiddle] Use "do { } while (0)" to ensure requiring "; "
https://git.ruby-lang.org/ruby.git/commit/?id=50fbd00e76 From 50fbd00e76f2a7a6ed17e73605fa69ce80cafb01 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei <kou@c...> Date: Sat, 27 Jun 2020 07:10:37 +0900 Subject: [ruby/fiddle] Use "do { } while (0)" to ensure requiring ";" https://github.com/ruby/fiddle/commit/2155ae5979 diff --git a/ext/fiddle/function.c b/ext/fiddle/function.c index b624255..95648d3 100644 --- a/ext/fiddle/function.c +++ b/ext/fiddle/function.c @@ -19,14 +19,14 @@ VALUE cFiddleFunction; https://github.com/ruby/ruby/blob/trunk/ext/fiddle/function.c#L19 #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) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/