ruby-changes:57756
From: Nobuyoshi <ko1@a...>
Date: Sun, 15 Sep 2019 13:33:58 +0900 (JST)
Subject: [ruby-changes:57756] 44d594189a (master): rb_scan_args_count_lead: use arguments instead of magic numbers
https://git.ruby-lang.org/ruby.git/commit/?id=44d594189a From 44d594189aa2b1365b9b765cb272906b9561cc1d Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 15 Sep 2019 13:29:12 +0900 Subject: rb_scan_args_count_lead: use arguments instead of magic numbers diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index b60afde..c438b0a 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -2370,14 +2370,16 @@ ERRORFUNC(("variable argument length doesn't match"), void rb_scan_args_length_m https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L2370 rb_scan_args_count_trail(fmt, ofs+1, vari+1)) # define rb_scan_args_count_opt(fmt, ofs, vari) \ - (!rb_scan_args_isdigit(fmt[1]) ? \ + (!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')) -# define rb_scan_args_count(fmt) \ - (!rb_scan_args_isdigit(fmt[0]) ? \ - rb_scan_args_count_var(fmt, 0, 0) : \ - rb_scan_args_count_opt(fmt, 1, fmt[0]-'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')) + +# define rb_scan_args_count(fmt) rb_scan_args_count_lead(fmt, 0, 0) # if defined(__has_attribute) && __has_attribute(diagnose_if) # define rb_scan_args_verify(fmt, varc) (void)0 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/