From c96f53e1aa7a82a05d7eb11388d17f2ca73e4edf Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 6 Jan 2004 14:00:54 +0000 Subject: [PATCH] * eval.c (rb_mod_modfunc): should break if m has no super class. [ruby-dev:22498] * backport changes from 1.9 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 31 +++++++++++++++++++++++++++++-- configure.in | 2 +- eval.c | 1 + ext/syck/emitter.c | 2 +- ext/tk/lib/multi-tk.rb | 2 +- io.c | 33 ++++++++++++++++----------------- lib/cgi/session.rb | 4 ++-- misc/ruby-mode.el | 5 ++++- pack.c | 14 ++++++++++---- 9 files changed, 65 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 26a09a5ebd..ad7d10a579 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,11 @@ +Tue Jan 6 22:13:34 2004 Yukihiro Matsumoto + + * eval.c (rb_mod_modfunc): should break if m has no super class. + [ruby-dev:22498] + Tue Jan 6 21:55:02 2004 Nobuyoshi Nakada - * io.c (fptr_finalize): should save errno just after failure. + * io.c (fptr_finalize): should save errno just after failure.w [ruby-dev:22492] Tue Jan 6 14:53:14 2004 Dave Thomas @@ -71,7 +76,16 @@ Fri Jan 2 14:54:11 2004 Dave Thomas Fix problem with labels not displaying in RI labeled lists using BS and ANSI modes. -Wed Dec 31 11:20:34 2003 +Fri Jan 2 01:50:13 2004 Yukihiro Matsumoto + + * io.c (argf_eof): ARGF.eof? should not have any side effect. + [ruby-dev:22469] + +Wed Dec 31 17:25:17 2003 Yukihiro Matsumoto + + * io.c (argf_each_byte): should return self. [ruby-dev:22465] + +Wed Dec 31 11:20:34 2003 Dave Thomas * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::do_methods): Make file referenced in "// in sss.c" relative to current file. @@ -87,6 +101,19 @@ Wed Dec 31 01:33:05 2003 Dave Thomas * array.c, error.c, eval.c, io.c, prec.c, range.c, re.c, string.c, time.c: Add RDoc for Kernel functions, and tidy. +Tue Dec 30 19:39:14 2003 Yukihiro Matsumoto + + * io.c (rb_f_readline): should raise EOFError at the end of + files. [ruby-dev:22458] + + * io.c (argf_read): should concatenate input files when length + argument is nil. [ruby-dev:22450] + + * io.c (argf_read): should update supplied string buffer (2nd + argument) even when IO#read is called multiple times. + + * io.c: should initialize lineno by zero. [ruby-dev:22460] + Tue Dec 30 12:30:30 2003 Dave Thomas * lib/rdoc/code_objects.rb (RDoc::Context::find_symbol): If a diff --git a/configure.in b/configure.in index 1704619fec..c51fd57b15 100644 --- a/configure.in +++ b/configure.in @@ -707,7 +707,7 @@ if test x"$enable_pthread" = xyes; then else AC_MSG_WARN("Don't know how to find pthread library on your system -- thread support disabled") fi - AC_CHECK_FUNC(nanosleep) + AC_CHECK_FUNCS(nanosleep) if test x"$ac_cv_func_nanosleep" = xno; then AC_CHECK_LIB(rt, nanosleep) if test x"$ac_cv_lib_rt_nanosleep" = xyes; then diff --git a/eval.c b/eval.c index 6d88111a85..3161f4573e 100644 --- a/eval.c +++ b/eval.c @@ -7055,6 +7055,7 @@ rb_mod_modfunc(argc, argv, module) break; /* normal case: need not to follow 'super' link */ } m = RCLASS(m)->super; + if (!m) break; } rb_add_method(rb_singleton_class(module), id, body->nd_body, NOEX_PUBLIC); } diff --git a/ext/syck/emitter.c b/ext/syck/emitter.c index 4dcc8b3fc5..d373ed4c45 100644 --- a/ext/syck/emitter.c +++ b/ext/syck/emitter.c @@ -239,7 +239,7 @@ syck_emitter_write( SyckEmitter *e, char *str, long len ) long rest = e->bufsize - (e->marker - e->buffer); if (len <= rest) break; S_MEMCPY( e->marker, str, char, rest ); - e->marker += len; + e->marker += rest; str += rest; len -= rest; syck_emitter_flush( e, 0 ); diff --git a/ext/tk/lib/multi-tk.rb b/ext/tk/lib/multi-tk.rb index b6c800177f..c2dcb4f971 100644 --- a/ext/tk/lib/multi-tk.rb +++ b/ext/tk/lib/multi-tk.rb @@ -17,7 +17,7 @@ TclTkLib.mainloop_abort_on_exception = true ################################################ # exceptiopn to treat the return value from IP class MultiTkIp_OK < Exception - def self.send(thred, ret=nil) + def self.send(thread, ret=nil) thread.raise self.new(ret) end diff --git a/io.c b/io.c index 6b1dd4c275..edce093cd0 100644 --- a/io.c +++ b/io.c @@ -114,7 +114,7 @@ struct timeval rb_time_interval _((VALUE)); static VALUE filename, current_file; static int gets_lineno; static int init_p = 0, next_p = 0; -static VALUE lineno; +static VALUE lineno = FIX2INT(0); #ifdef _STDIO_USES_IOSTREAM /* GNU libc */ # ifdef _IO_fpos_t @@ -4105,7 +4105,8 @@ rb_f_readline(argc, argv) { VALUE line; - NEXT_ARGF_FORWARD(); + if (!next_argv()) rb_eof_error(); + ARGF_FORWARD(); line = rb_f_gets(argc, argv); if (NIL_P(line)) { rb_eof_error(); @@ -4901,7 +4902,6 @@ argf_eof() if (init_p == 0) return Qtrue; ARGF_FORWARD(); if (rb_io_eof(current_file)) { - next_p = 1; return Qtrue; } } @@ -4913,23 +4913,22 @@ argf_read(argc, argv) int argc; VALUE *argv; { - VALUE tmp, str; + VALUE tmp, str, length; long len = 0; - if (argc == 1 && !NIL_P(argv[0])) + rb_scan_args(argc, argv, "02", &length, &str); + if (!NIL_P(length)) { len = NUM2LONG(argv[0]); - str = Qnil; + } + if (!NIL_P(str)) { + StringValue(str); + rb_str_resize(str,0); + argv[1] = Qnil; + } retry: if (!next_argv()) { - if (NIL_P(str)) { - VALUE length; - - rb_scan_args(argc, argv, "02", &length, &str); - if (NIL_P(str)) return rb_str_new(0,0); - StringValue(str); - rb_str_resize(str,0); - } + if (NIL_P(str)) return rb_str_new(0,0); return str; } if (TYPE(current_file) != T_FILE) { @@ -4940,14 +4939,14 @@ argf_read(argc, argv) } if (NIL_P(str)) str = tmp; else rb_str_append(str, tmp); - if (NIL_P(tmp) || argc == 0) { + if (NIL_P(tmp) || NIL_P(length)) { if (next_p != -1) { argf_close(current_file); next_p = 1; goto retry; } } - else if (argc == 1) { + else if (argc >= 1) { if (RSTRING(str)->len < len) { len -= RSTRING(str)->len; argv[0] = INT2NUM(len); @@ -5021,7 +5020,7 @@ argf_each_byte() while (!NIL_P(byte = argf_getc())) { rb_yield(byte); } - return Qnil; + return argf; } static VALUE diff --git a/lib/cgi/session.rb b/lib/cgi/session.rb index 4ad6bf2a67..10266b56ff 100644 --- a/lib/cgi/session.rb +++ b/lib/cgi/session.rb @@ -209,8 +209,8 @@ class CGI # session id is stored in a cookie. # # session_expires:: the time the current session expires, as a - # +Time+ object. If not set, the session will continue - # indefinitely. + # +Time+ object. If not set, the session will terminate + # when the user's browser is closed. # session_domain:: the hostname domain for which this session is valid. # If not set, defaults to the hostname of the server. # session_secure:: if +true+, this session will only work over HTTPS. diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el index 631f78f78a..081218c408 100644 --- a/misc/ruby-mode.el +++ b/misc/ruby-mode.el @@ -964,7 +964,10 @@ balanced expression is found." ;; get current method (or class/module) (if (re-search-backward (concat "^[ \t]*\\(def\\|class\\|module\\)[ \t]+" - "\\(" ruby-symbol-re "+\\)") + "\\(" + ;; \\. for class method + "\\(" ruby-symbol-re "\\|\\." "\\)" + "+\\)") nil t) (progn (setq mlist (list (match-string 2))) diff --git a/pack.c b/pack.c index 4763c81c29..4edffd3801 100644 --- a/pack.c +++ b/pack.c @@ -22,12 +22,14 @@ #endif #ifdef NATINT_PACK +# define OFF16B(p) ((char*)(p) + (natint?0:(sizeof(short) - SIZE16))) +# define OFF32B(p) ((char*)(p) + (natint?0:(sizeof(long) - SIZE32))) # define NATINT_I32(x) (natint?NUM2LONG(x):(NUM2I32(x))) # define NATINT_U32(x) (natint?NUM2ULONG(x):(NUM2U32(x))) # define NATINT_LEN(type,len) (natint?sizeof(type):(len)) # ifdef WORDS_BIGENDIAN -# define OFF16(p) ((char*)(p) + (natint?0:(sizeof(short) - SIZE16))) -# define OFF32(p) ((char*)(p) + (natint?0:(sizeof(long) - SIZE32))) +# define OFF16(p) OFF16B(p) +# define OFF32(p) OFF32B(p) # endif # define NATINT_HTOVS(x) (natint?htovs(x):htov16(x)) # define NATINT_HTOVL(x) (natint?htovl(x):htov32(x)) @@ -47,6 +49,10 @@ # define OFF16(p) (char*)(p) # define OFF32(p) (char*)(p) #endif +#ifndef OFF16B +# define OFF16B(p) (char*)(p) +# define OFF32B(p) (char*)(p) +#endif #define define_swapx(x, xtype) \ static xtype \ @@ -1648,7 +1654,7 @@ pack_unpack(str, fmt) PACK_LENGTH_ADJUST(unsigned short,2); while (len-- > 0) { unsigned short tmp = 0; - memcpy(OFF16(&tmp), s, NATINT_LEN(unsigned short,2)); + memcpy(OFF16B(&tmp), s, NATINT_LEN(unsigned short,2)); s += NATINT_LEN(unsigned short,2); rb_ary_push(ary, UINT2NUM(ntohs(tmp))); } @@ -1659,7 +1665,7 @@ pack_unpack(str, fmt) PACK_LENGTH_ADJUST(unsigned long,4); while (len-- > 0) { unsigned long tmp = 0; - memcpy(OFF32(&tmp), s, NATINT_LEN(unsigned long,4)); + memcpy(OFF32B(&tmp), s, NATINT_LEN(unsigned long,4)); s += NATINT_LEN(unsigned long,4); rb_ary_push(ary, ULONG2NUM(ntohl(tmp))); }