1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
matz 2004-01-06 14:00:54 +00:00
parent 4e8cfd8b47
commit c96f53e1aa
9 changed files with 65 additions and 29 deletions

View file

@ -1,6 +1,11 @@
Tue Jan 6 22:13:34 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* 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 <nobu@ruby-lang.org> Tue Jan 6 21:55:02 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (fptr_finalize): should save errno just after failure. * io.c (fptr_finalize): should save errno just after failure.w
[ruby-dev:22492] [ruby-dev:22492]
Tue Jan 6 14:53:14 2004 Dave Thomas <dave@pragprog.com> Tue Jan 6 14:53:14 2004 Dave Thomas <dave@pragprog.com>
@ -71,7 +76,16 @@ Fri Jan 2 14:54:11 2004 Dave Thomas <dave@pragprog.com>
Fix problem with labels not displaying in RI labeled Fix problem with labels not displaying in RI labeled
lists using BS and ANSI modes. lists using BS and ANSI modes.
Wed Dec 31 11:20:34 2003 <dave@pragprog.com> Fri Jan 2 01:50:13 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (argf_eof): ARGF.eof? should not have any side effect.
[ruby-dev:22469]
Wed Dec 31 17:25:17 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (argf_each_byte): should return self. [ruby-dev:22465]
Wed Dec 31 11:20:34 2003 Dave Thomas <dave@pragprog.com>
* lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::do_methods): Make * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::do_methods): Make
file referenced in "// in sss.c" relative to current file. file referenced in "// in sss.c" relative to current file.
@ -87,6 +101,19 @@ Wed Dec 31 01:33:05 2003 Dave Thomas <dave@pragprog.com>
* array.c, error.c, eval.c, io.c, prec.c, range.c, re.c, * 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. string.c, time.c: Add RDoc for Kernel functions, and tidy.
Tue Dec 30 19:39:14 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* 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 <dave@pragprog.com> Tue Dec 30 12:30:30 2003 Dave Thomas <dave@pragprog.com>
* lib/rdoc/code_objects.rb (RDoc::Context::find_symbol): If a * lib/rdoc/code_objects.rb (RDoc::Context::find_symbol): If a

View file

@ -707,7 +707,7 @@ if test x"$enable_pthread" = xyes; then
else else
AC_MSG_WARN("Don't know how to find pthread library on your system -- thread support disabled") AC_MSG_WARN("Don't know how to find pthread library on your system -- thread support disabled")
fi fi
AC_CHECK_FUNC(nanosleep) AC_CHECK_FUNCS(nanosleep)
if test x"$ac_cv_func_nanosleep" = xno; then if test x"$ac_cv_func_nanosleep" = xno; then
AC_CHECK_LIB(rt, nanosleep) AC_CHECK_LIB(rt, nanosleep)
if test x"$ac_cv_lib_rt_nanosleep" = xyes; then if test x"$ac_cv_lib_rt_nanosleep" = xyes; then

1
eval.c
View file

@ -7055,6 +7055,7 @@ rb_mod_modfunc(argc, argv, module)
break; /* normal case: need not to follow 'super' link */ break; /* normal case: need not to follow 'super' link */
} }
m = RCLASS(m)->super; m = RCLASS(m)->super;
if (!m) break;
} }
rb_add_method(rb_singleton_class(module), id, body->nd_body, NOEX_PUBLIC); rb_add_method(rb_singleton_class(module), id, body->nd_body, NOEX_PUBLIC);
} }

View file

@ -239,7 +239,7 @@ syck_emitter_write( SyckEmitter *e, char *str, long len )
long rest = e->bufsize - (e->marker - e->buffer); long rest = e->bufsize - (e->marker - e->buffer);
if (len <= rest) break; if (len <= rest) break;
S_MEMCPY( e->marker, str, char, rest ); S_MEMCPY( e->marker, str, char, rest );
e->marker += len; e->marker += rest;
str += rest; str += rest;
len -= rest; len -= rest;
syck_emitter_flush( e, 0 ); syck_emitter_flush( e, 0 );

View file

@ -17,7 +17,7 @@ TclTkLib.mainloop_abort_on_exception = true
################################################ ################################################
# exceptiopn to treat the return value from IP # exceptiopn to treat the return value from IP
class MultiTkIp_OK < Exception class MultiTkIp_OK < Exception
def self.send(thred, ret=nil) def self.send(thread, ret=nil)
thread.raise self.new(ret) thread.raise self.new(ret)
end end

33
io.c
View file

@ -114,7 +114,7 @@ struct timeval rb_time_interval _((VALUE));
static VALUE filename, current_file; static VALUE filename, current_file;
static int gets_lineno; static int gets_lineno;
static int init_p = 0, next_p = 0; static int init_p = 0, next_p = 0;
static VALUE lineno; static VALUE lineno = FIX2INT(0);
#ifdef _STDIO_USES_IOSTREAM /* GNU libc */ #ifdef _STDIO_USES_IOSTREAM /* GNU libc */
# ifdef _IO_fpos_t # ifdef _IO_fpos_t
@ -4105,7 +4105,8 @@ rb_f_readline(argc, argv)
{ {
VALUE line; VALUE line;
NEXT_ARGF_FORWARD(); if (!next_argv()) rb_eof_error();
ARGF_FORWARD();
line = rb_f_gets(argc, argv); line = rb_f_gets(argc, argv);
if (NIL_P(line)) { if (NIL_P(line)) {
rb_eof_error(); rb_eof_error();
@ -4901,7 +4902,6 @@ argf_eof()
if (init_p == 0) return Qtrue; if (init_p == 0) return Qtrue;
ARGF_FORWARD(); ARGF_FORWARD();
if (rb_io_eof(current_file)) { if (rb_io_eof(current_file)) {
next_p = 1;
return Qtrue; return Qtrue;
} }
} }
@ -4913,23 +4913,22 @@ argf_read(argc, argv)
int argc; int argc;
VALUE *argv; VALUE *argv;
{ {
VALUE tmp, str; VALUE tmp, str, length;
long len = 0; 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]); len = NUM2LONG(argv[0]);
str = Qnil; }
if (!NIL_P(str)) {
StringValue(str);
rb_str_resize(str,0);
argv[1] = Qnil;
}
retry: retry:
if (!next_argv()) { if (!next_argv()) {
if (NIL_P(str)) { if (NIL_P(str)) return rb_str_new(0,0);
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);
}
return str; return str;
} }
if (TYPE(current_file) != T_FILE) { if (TYPE(current_file) != T_FILE) {
@ -4940,14 +4939,14 @@ argf_read(argc, argv)
} }
if (NIL_P(str)) str = tmp; if (NIL_P(str)) str = tmp;
else rb_str_append(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) { if (next_p != -1) {
argf_close(current_file); argf_close(current_file);
next_p = 1; next_p = 1;
goto retry; goto retry;
} }
} }
else if (argc == 1) { else if (argc >= 1) {
if (RSTRING(str)->len < len) { if (RSTRING(str)->len < len) {
len -= RSTRING(str)->len; len -= RSTRING(str)->len;
argv[0] = INT2NUM(len); argv[0] = INT2NUM(len);
@ -5021,7 +5020,7 @@ argf_each_byte()
while (!NIL_P(byte = argf_getc())) { while (!NIL_P(byte = argf_getc())) {
rb_yield(byte); rb_yield(byte);
} }
return Qnil; return argf;
} }
static VALUE static VALUE

View file

@ -209,8 +209,8 @@ class CGI
# session id is stored in a cookie. # session id is stored in a cookie.
# #
# session_expires:: the time the current session expires, as a # session_expires:: the time the current session expires, as a
# +Time+ object. If not set, the session will continue # +Time+ object. If not set, the session will terminate
# indefinitely. # when the user's browser is closed.
# session_domain:: the hostname domain for which this session is valid. # session_domain:: the hostname domain for which this session is valid.
# If not set, defaults to the hostname of the server. # If not set, defaults to the hostname of the server.
# session_secure:: if +true+, this session will only work over HTTPS. # session_secure:: if +true+, this session will only work over HTTPS.

View file

@ -964,7 +964,10 @@ balanced expression is found."
;; get current method (or class/module) ;; get current method (or class/module)
(if (re-search-backward (if (re-search-backward
(concat "^[ \t]*\\(def\\|class\\|module\\)[ \t]+" (concat "^[ \t]*\\(def\\|class\\|module\\)[ \t]+"
"\\(" ruby-symbol-re "+\\)") "\\("
;; \\. for class method
"\\(" ruby-symbol-re "\\|\\." "\\)"
"+\\)")
nil t) nil t)
(progn (progn
(setq mlist (list (match-string 2))) (setq mlist (list (match-string 2)))

14
pack.c
View file

@ -22,12 +22,14 @@
#endif #endif
#ifdef NATINT_PACK #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_I32(x) (natint?NUM2LONG(x):(NUM2I32(x)))
# define NATINT_U32(x) (natint?NUM2ULONG(x):(NUM2U32(x))) # define NATINT_U32(x) (natint?NUM2ULONG(x):(NUM2U32(x)))
# define NATINT_LEN(type,len) (natint?sizeof(type):(len)) # define NATINT_LEN(type,len) (natint?sizeof(type):(len))
# ifdef WORDS_BIGENDIAN # ifdef WORDS_BIGENDIAN
# define OFF16(p) ((char*)(p) + (natint?0:(sizeof(short) - SIZE16))) # define OFF16(p) OFF16B(p)
# define OFF32(p) ((char*)(p) + (natint?0:(sizeof(long) - SIZE32))) # define OFF32(p) OFF32B(p)
# endif # endif
# define NATINT_HTOVS(x) (natint?htovs(x):htov16(x)) # define NATINT_HTOVS(x) (natint?htovs(x):htov16(x))
# define NATINT_HTOVL(x) (natint?htovl(x):htov32(x)) # define NATINT_HTOVL(x) (natint?htovl(x):htov32(x))
@ -47,6 +49,10 @@
# define OFF16(p) (char*)(p) # define OFF16(p) (char*)(p)
# define OFF32(p) (char*)(p) # define OFF32(p) (char*)(p)
#endif #endif
#ifndef OFF16B
# define OFF16B(p) (char*)(p)
# define OFF32B(p) (char*)(p)
#endif
#define define_swapx(x, xtype) \ #define define_swapx(x, xtype) \
static xtype \ static xtype \
@ -1648,7 +1654,7 @@ pack_unpack(str, fmt)
PACK_LENGTH_ADJUST(unsigned short,2); PACK_LENGTH_ADJUST(unsigned short,2);
while (len-- > 0) { while (len-- > 0) {
unsigned short tmp = 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); s += NATINT_LEN(unsigned short,2);
rb_ary_push(ary, UINT2NUM(ntohs(tmp))); rb_ary_push(ary, UINT2NUM(ntohs(tmp)));
} }
@ -1659,7 +1665,7 @@ pack_unpack(str, fmt)
PACK_LENGTH_ADJUST(unsigned long,4); PACK_LENGTH_ADJUST(unsigned long,4);
while (len-- > 0) { while (len-- > 0) {
unsigned long tmp = 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); s += NATINT_LEN(unsigned long,4);
rb_ary_push(ary, ULONG2NUM(ntohl(tmp))); rb_ary_push(ary, ULONG2NUM(ntohl(tmp)));
} }