summaryrefslogtreecommitdiffstats
path: root/class.c
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-24 15:41:39 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-24 15:41:39 +0000
commit70475e65416b72cc4d34f9bc343801f88606492e (patch)
treef93502bd3522eb607fba9614da01d9e0b3e44aa4 /class.c
parentc652d24078619eb1a0e802fa5b2c6e48cf7ab14c (diff)
downloadruby-70475e65416b72cc4d34f9bc343801f88606492e.tar.gz
ruby-70475e65416b72cc4d34f9bc343801f88606492e.tar.xz
ruby-70475e65416b72cc4d34f9bc343801f88606492e.zip
* class.c (rb_scan_args): Allow specifying the number of trailing
mandatory arguments right after the number of optional arguments only if the number of leading mandatory arguments is not omitted. * ext/socket/tcpserver.c (tcp_svr_init): Make use of it. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
-rw-r--r--class.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/class.c b/class.c
index 7ba47e4e2..a75a789ce 100644
--- a/class.c
+++ b/class.c
@@ -934,6 +934,11 @@ rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...)
if (ISDIGIT(*p)) {
n_opt = *p - '0';
p++;
+ if (ISDIGIT(*p)) {
+ n_trail = *p - '0';
+ p++;
+ goto block_arg;
+ }
}
}
if (*p == '*') {
@@ -944,6 +949,7 @@ rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...)
p++;
}
}
+ block_arg:
if (*p == '&') {
f_block = 1;
p++;