summaryrefslogtreecommitdiff
path: root/ext/socket/tcpserver.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
commit400ded9338961ce39b3cd9cb58f03277e0a37f2d (patch)
treef93502bd3522eb607fba9614da01d9e0b3e44aa4 /ext/socket/tcpserver.c
parent02316f11d5cabf4a5cbaaa1f9f48711d5c61b7dd (diff)
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@22603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/tcpserver.c')
-rw-r--r--ext/socket/tcpserver.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/ext/socket/tcpserver.c b/ext/socket/tcpserver.c
index 85020c4..111babd 100644
--- a/ext/socket/tcpserver.c
+++ b/ext/socket/tcpserver.c
@@ -26,12 +26,10 @@
static VALUE
tcp_svr_init(int argc, VALUE *argv, VALUE sock)
{
- VALUE arg1, arg2;
+ VALUE hostname, port;
- if (rb_scan_args(argc, argv, "11", &arg1, &arg2) == 2)
- return init_inetsock(sock, arg1, arg2, Qnil, Qnil, INET_SERVER);
- else
- return init_inetsock(sock, Qnil, arg1, Qnil, Qnil, INET_SERVER);
+ rb_scan_args(argc, argv, "011", &hostname, &port);
+ return init_inetsock(sock, hostname, port, Qnil, Qnil, INET_SERVER);
}
/*