summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-13 11:31:27 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-13 11:31:27 +0000
commit5a712cfb8ce6947dfc5bcd8b7f27153dd576e13a (patch)
treee23a8d3f06e248b77e410c97718a179011b99d1b
parentf2ded65a58f6fed573df3e33f5278796ea2bf26a (diff)
* ext/socket/socket.c (Init_socket): remove obsolete constants:
IPsocket, TCPsocket, SOCKSsocket, TCPserver, UDPsocket, UNIXsocket, UNIXserver. * eval.c (formal_assign): post splat arguments should have had higher priority than optional arguments, since they are mandatory. [ruby-dev:28715] * eval.c (VIS_MASK): broken. should be 15. [ruby-dev:28715] * io.c (argf_getc): should return one-character string. [ruby-dev:28715] * io.c (rb_io_readchar): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog20
-rw-r--r--eval.c16
-rw-r--r--ext/socket/socket.c7
-rw-r--r--io.c4
-rw-r--r--sprintf.c2
5 files changed, 34 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index de3dfd7318..c2b2b80351 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+Tue Jun 13 17:22:19 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (Init_socket): remove obsolete constants:
+ IPsocket, TCPsocket, SOCKSsocket, TCPserver, UDPsocket,
+ UNIXsocket, UNIXserver.
+
+Tue Jun 13 09:07:27 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (formal_assign): post splat arguments should have had
+ higher priority than optional arguments, since they are
+ mandatory. [ruby-dev:28715]
+
+ * eval.c (VIS_MASK): broken. should be 15. [ruby-dev:28715]
+
+ * io.c (argf_getc): should return one-character string.
+ [ruby-dev:28715]
+
+ * io.c (rb_io_readchar): ditto.
+
Sun Jun 11 23:20:07 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* object.c (sym_call): disallow to call private methods.
@@ -21,6 +40,7 @@ Sun Jun 11 04:38:20 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* object.c (sym_to_proc): imported Symbol#to_proc from ActiveSupport.
+>>>>>>> 1.5068
Sat Jun 10 18:02:40 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* ext/bigdecimal/lib/bigdecimal/newton.rb (Newton::nlsolve): typo
diff --git a/eval.c b/eval.c
index 5f5152b1f8..7fae5300ab 100644
--- a/eval.c
+++ b/eval.c
@@ -254,7 +254,7 @@ static int vis_mode;
#define VIS_PROTECTED 2
#define VIS_MODFUNC 5
#define VIS_LOCAL 8
-#define VIS_MASK 16
+#define VIS_MASK 15
#define VIS_SET(f) (vis_mode=(f))
#define VIS_TEST(f) (vis_mode&(f))
#define VIS_MODE() (vis_mode)
@@ -5555,6 +5555,7 @@ formal_assign(VALUE recv, NODE *node, int argc, const VALUE *argv, VALUE *local_
{
int i;
int nopt = 0;
+ int npost = 0;
if (nd_type(node) != NODE_ARGS) {
rb_bug("no argument-node");
@@ -5591,18 +5592,23 @@ formal_assign(VALUE recv, NODE *node, int argc, const VALUE *argv, VALUE *local_
}
}
argv += i; argc -= i;
+ if (node->nd_rest && nd_type(node->nd_rest) == NODE_POSTARG) {
+ npost = node->nd_rest->nd_head->nd_alen;
+ }
if (node->nd_opt) {
NODE *opt = node->nd_opt;
+ int ac = argc - npost;
- while (opt && argc) {
+ while (opt && ac) {
assign(recv, opt->nd_head, *argv, 1);
- argv++; argc--;
+ argv++; ac--;
++i;
opt = opt->nd_next;
}
if (opt) {
rb_eval(recv, opt);
}
+ argc = ac + npost;
}
if (!node->nd_rest) {
i = nopt;
@@ -5613,9 +5619,7 @@ formal_assign(VALUE recv, NODE *node, int argc, const VALUE *argv, VALUE *local_
if (argc > 0) {
int n = 1;
v = rb_ary_new4(argc,argv);
- if (nd_type(node->nd_rest) == NODE_POSTARG) {
- n += node->nd_rest->nd_head->nd_alen;
- }
+ n += npost;
i += n*256;
}
else {
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index a5d486a68e..3f4c07526b 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -3642,7 +3642,6 @@ Init_socket()
rb_define_method(rb_cBasicSocket, "do_not_reverse_lookup=", bsock_do_not_reverse_lookup_set, 1);
rb_cIPSocket = rb_define_class("IPSocket", rb_cBasicSocket);
- rb_define_global_const("IPsocket", rb_cIPSocket);
rb_define_method(rb_cIPSocket, "addr", ip_addr, 0);
rb_define_method(rb_cIPSocket, "peeraddr", ip_peeraddr, 0);
rb_define_method(rb_cIPSocket, "recvfrom", ip_recvfrom, -1);
@@ -3650,13 +3649,11 @@ Init_socket()
rb_define_singleton_method(rb_cIPSocket, "getaddress", ip_s_getaddress, 1);
rb_cTCPSocket = rb_define_class("TCPSocket", rb_cIPSocket);
- rb_define_global_const("TCPsocket", rb_cTCPSocket);
rb_define_singleton_method(rb_cTCPSocket, "gethostbyname", tcp_s_gethostbyname, 1);
rb_define_method(rb_cTCPSocket, "initialize", tcp_init, -1);
#ifdef SOCKS
rb_cSOCKSSocket = rb_define_class("SOCKSSocket", rb_cTCPSocket);
- rb_define_global_const("SOCKSsocket", rb_cSOCKSSocket);
rb_define_method(rb_cSOCKSSocket, "initialize", socks_init, 2);
#ifdef SOCKS5
rb_define_method(rb_cSOCKSSocket, "close", socks_s_close, 0);
@@ -3664,7 +3661,6 @@ Init_socket()
#endif
rb_cTCPServer = rb_define_class("TCPServer", rb_cTCPSocket);
- rb_define_global_const("TCPserver", rb_cTCPServer);
rb_define_method(rb_cTCPServer, "accept", tcp_accept, 0);
rb_define_method(rb_cTCPServer, "accept_nonblock", tcp_accept_nonblock, 0);
rb_define_method(rb_cTCPServer, "sysaccept", tcp_sysaccept, 0);
@@ -3672,7 +3668,6 @@ Init_socket()
rb_define_method(rb_cTCPServer, "listen", sock_listen, 1);
rb_cUDPSocket = rb_define_class("UDPSocket", rb_cIPSocket);
- rb_define_global_const("UDPsocket", rb_cUDPSocket);
rb_define_method(rb_cUDPSocket, "initialize", udp_init, -1);
rb_define_method(rb_cUDPSocket, "connect", udp_connect, 2);
rb_define_method(rb_cUDPSocket, "bind", udp_bind, 2);
@@ -3680,7 +3675,6 @@ Init_socket()
#ifdef HAVE_SYS_UN_H
rb_cUNIXSocket = rb_define_class("UNIXSocket", rb_cBasicSocket);
- rb_define_global_const("UNIXsocket", rb_cUNIXSocket);
rb_define_method(rb_cUNIXSocket, "initialize", unix_init, 1);
rb_define_method(rb_cUNIXSocket, "path", unix_path, 0);
rb_define_method(rb_cUNIXSocket, "addr", unix_addr, 0);
@@ -3693,7 +3687,6 @@ Init_socket()
rb_define_singleton_method(rb_cUNIXSocket, "pair", unix_s_socketpair, -1);
rb_cUNIXServer = rb_define_class("UNIXServer", rb_cUNIXSocket);
- rb_define_global_const("UNIXserver", rb_cUNIXServer);
rb_define_method(rb_cUNIXServer, "initialize", unix_svr_init, 1);
rb_define_method(rb_cUNIXServer, "accept", unix_accept, 0);
rb_define_method(rb_cUNIXServer, "accept_nonblock", unix_accept_nonblock, 0);
diff --git a/io.c b/io.c
index 9cd5d91d28..ff32f0816f 100644
--- a/io.c
+++ b/io.c
@@ -2039,7 +2039,7 @@ rb_getc(FILE *f)
static VALUE
rb_io_readchar(VALUE io)
{
- VALUE c = rb_io_getc(io);
+ VALUE c = rb_io_getc_m(io);
if (NIL_P(c)) {
rb_eof_error();
@@ -5356,7 +5356,7 @@ argf_getc(void)
ch = rb_funcall3(current_file, rb_intern("getc"), 0, 0);
}
else {
- ch = rb_io_getc(current_file);
+ ch = rb_io_getc_m(current_file);
}
if (NIL_P(ch) && next_p != -1) {
argf_close(current_file);
diff --git a/sprintf.c b/sprintf.c
index 22c8c12d1c..90b1168d63 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -13,6 +13,7 @@
**********************************************************************/
#include "ruby.h"
+#include "re.h"
#include <ctype.h>
#include <math.h>
#include <stdarg.h>
@@ -428,6 +429,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
len = prec;
}
}
+ /* need to adjust multi-byte string pos */
if (flags&FWIDTH) {
if (width > len) {
CHECK(width);