[前][次][番号順一覧][スレッド一覧]

ruby-changes:59913

From: Nobuyoshi <ko1@a...>
Date: Mon, 3 Feb 2020 14:25:10 +0900 (JST)
Subject: [ruby-changes:59913] db69c50987 (master): Parenthesized macro arguments

https://git.ruby-lang.org/ruby.git/commit/?id=db69c50987

From db69c5098781087c954e5fc0aaf3079a66f6d6d5 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 3 Feb 2020 14:19:02 +0900
Subject: Parenthesized macro arguments


diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 79ba900..db2124f 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -2331,37 +2331,37 @@ ERRORFUNC(("variable argument length doesn't match"), void rb_scan_args_length_m https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L2331
 # define rb_scan_args_isdigit(c) ((unsigned char)((c)-'0')<10)
 
 #  define rb_scan_args_count_end(fmt, ofs, vari) \
-     (fmt[ofs] ? -1 : (vari))
+     ((fmt)[ofs] ? -1 : (vari))
 
 # define rb_scan_args_count_block(fmt, ofs, vari) \
-    (fmt[ofs]!='&' ? \
+    ((fmt)[ofs]!='&' ? \
      rb_scan_args_count_end(fmt, ofs, vari) : \
-     rb_scan_args_count_end(fmt, ofs+1, vari+1))
+     rb_scan_args_count_end(fmt, (ofs)+1, (vari)+1))
 
 # define rb_scan_args_count_hash(fmt, ofs, vari) \
-    (fmt[ofs]!=':' ? \
+    ((fmt)[ofs]!=':' ? \
      rb_scan_args_count_block(fmt, ofs, vari) : \
-     rb_scan_args_count_block(fmt, ofs+1, vari+1))
+     rb_scan_args_count_block(fmt, (ofs)+1, (vari)+1))
 
 # define rb_scan_args_count_trail(fmt, ofs, vari) \
-    (!rb_scan_args_isdigit(fmt[ofs]) ? \
+    (!rb_scan_args_isdigit((fmt)[ofs]) ? \
      rb_scan_args_count_hash(fmt, ofs, vari) : \
-     rb_scan_args_count_hash(fmt, ofs+1, vari+(fmt[ofs]-'0')))
+     rb_scan_args_count_hash(fmt, (ofs)+1, (vari)+((fmt)[ofs]-'0')))
 
 # define rb_scan_args_count_var(fmt, ofs, vari) \
-    (fmt[ofs]!='*' ? \
+    ((fmt)[ofs]!='*' ? \
      rb_scan_args_count_trail(fmt, ofs, vari) : \
-     rb_scan_args_count_trail(fmt, ofs+1, vari+1))
+     rb_scan_args_count_trail(fmt, (ofs)+1, (vari)+1))
 
 # define rb_scan_args_count_opt(fmt, ofs, vari) \
-    (!rb_scan_args_isdigit(fmt[ofs]) ? \
+    (!rb_scan_args_isdigit((fmt)[ofs]) ? \
      rb_scan_args_count_var(fmt, ofs, vari) : \
-     rb_scan_args_count_var(fmt, ofs+1, vari+fmt[ofs]-'0'))
+     rb_scan_args_count_var(fmt, (ofs)+1, (vari)+(fmt)[ofs]-'0'))
 
 # define rb_scan_args_count_lead(fmt, ofs, vari) \
-    (!rb_scan_args_isdigit(fmt[ofs]) ? \
-      rb_scan_args_count_var(fmt, ofs, vari) : \
-      rb_scan_args_count_opt(fmt, ofs+1, vari+fmt[ofs]-'0'))
+    (!rb_scan_args_isdigit((fmt)[ofs]) ? \
+     rb_scan_args_count_var(fmt, ofs, vari) : \
+     rb_scan_args_count_opt(fmt, (ofs)+1, (vari)+(fmt)[ofs]-'0'))
 
 # define rb_scan_args_count(fmt) rb_scan_args_count_lead(fmt, 0, 0)
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]