mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ruby.h: rb_scan_args_validate
* include/ruby/ruby.h (rb_scan_args_validate): move failed condition to the terminal. [ruby-core:75714] [Bug #12426] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4c68173079
commit
c7bc778dde
2 changed files with 34 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed May 25 17:11:34 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* include/ruby/ruby.h (rb_scan_args_validate): move failed
|
||||
condition to the terminal. [ruby-core:75714] [Bug #12426]
|
||||
|
||||
Wed May 25 13:13:37 2016 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* regcomp.c: remove condition for debug output because prelude
|
||||
|
|
|
@ -2160,8 +2160,8 @@ ERRORFUNC(("bad scan arg format"), int rb_scan_args_bad_format(const char*));
|
|||
ERRORFUNC(("variable argument length doesn't match"), int rb_scan_args_length_mismatch(int,int));
|
||||
# else
|
||||
# define rb_scan_args_bad_format(fmt) 0
|
||||
# define rb_scan_args_length_mismatch(vari,varc) 0
|
||||
#endif
|
||||
# define rb_scan_args_length_mismatch(vari, varc) 0
|
||||
# endif
|
||||
|
||||
# define rb_scan_args_isdigit(c) ((unsigned char)((c)-'0')<10)
|
||||
|
||||
|
@ -2217,12 +2217,35 @@ ERRORFUNC(("variable argument length doesn't match"), int rb_scan_args_length_mi
|
|||
# define rb_scan_args_f_block(fmt) ((fmt)[rb_scan_args_block_idx(fmt)]=='&')
|
||||
# define rb_scan_args_end_idx(fmt) \
|
||||
(rb_scan_args_block_idx(fmt)+rb_scan_args_f_block(fmt))
|
||||
# define rb_scan_args_valid_p(fmt) (!(fmt)[rb_scan_args_end_idx(fmt)])
|
||||
|
||||
# define rb_scan_args_validate(fmt, varc) \
|
||||
(!rb_scan_args_isdigit((fmt)[0]) ? \
|
||||
rb_scan_args_validate_var(fmt, 0, varc) : \
|
||||
!rb_scan_args_isdigit((fmt)[1]) ? \
|
||||
rb_scan_args_validate_var(fmt, 1, (varc-(fmt)[0]+'0')) : \
|
||||
rb_scan_args_validate_var(fmt, 2, (varc-(fmt)[0]+'0'-(fmt)[1]+'0')))
|
||||
# define rb_scan_args_validate_var(fmt, ofs, varc) \
|
||||
((fmt)[ofs]=='*' ? \
|
||||
rb_scan_args_validate_trail(fmt, ofs+1, (varc-1)) : \
|
||||
rb_scan_args_validate_trail(fmt, ofs, varc))
|
||||
# define rb_scan_args_validate_trail(fmt, ofs, varc) \
|
||||
(rb_scan_args_isdigit((fmt)[ofs]) ? \
|
||||
rb_scan_args_validate_hash(fmt, ofs+1, (varc-1)) : \
|
||||
rb_scan_args_validate_hash(fmt, ofs, varc))
|
||||
# define rb_scan_args_validate_hash(fmt, ofs, varc) \
|
||||
((fmt)[ofs]==':' ? \
|
||||
rb_scan_args_validate_block(fmt, ofs+1, (varc-1)) : \
|
||||
rb_scan_args_validate_block(fmt, ofs, varc))
|
||||
# define rb_scan_args_validate_block(fmt, ofs, varc) \
|
||||
((fmt)[ofs]=='&' ? \
|
||||
rb_scan_args_validate_end(fmt, ofs+1, (varc-1)) : \
|
||||
rb_scan_args_validate_end(fmt, ofs, varc))
|
||||
# define rb_scan_args_validate_end(fmt, ofs, varc) \
|
||||
((fmt)[ofs]?rb_scan_args_bad_format(fmt):!(varc))
|
||||
|
||||
# define rb_scan_args_verify(fmt, varc) \
|
||||
(((varc)\
|
||||
/(rb_scan_args_valid_p(fmt)||rb_scan_args_bad_format(fmt))) \
|
||||
/(((varc)==rb_scan_args_count(fmt))|| \
|
||||
((varc)\
|
||||
/(rb_scan_args_validate(fmt, varc)|| \
|
||||
rb_scan_args_length_mismatch((varc), rb_scan_args_count(fmt))))
|
||||
|
||||
# define rb_scan_args0(argc, argv, fmt, varc, vars) \
|
||||
|
|
Loading…
Add table
Reference in a new issue