mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (read_all): should return given string even if data read is
empty. [ruby-dev:22207] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6395c3b38d
commit
f449c04a36
7 changed files with 23 additions and 26 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Dec 10 17:17:18 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* io.c (read_all): should return given string even if data read is
|
||||
empty. [ruby-dev:22207]
|
||||
|
||||
Wed Dec 10 17:16:06 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/stringio/stringio.c (strio_read): adjust behavior at reading
|
||||
|
|
2
error.c
2
error.c
|
@ -642,8 +642,6 @@ syserr_eqq(self, exc)
|
|||
return Qfalse;
|
||||
}
|
||||
|
||||
static void init_syserr _((void));
|
||||
|
||||
void
|
||||
Init_Exception()
|
||||
{
|
||||
|
|
|
@ -621,7 +621,7 @@ curses_pair_number(VALUE obj, VALUE attrs)
|
|||
{
|
||||
return INT2FIX(PAIR_NUMBER(NUM2INT(attrs)));
|
||||
}
|
||||
#endif
|
||||
#endif /* USE_COLOR */
|
||||
|
||||
#ifdef USE_MOUSE
|
||||
struct mousedata {
|
||||
|
@ -1443,7 +1443,7 @@ Init_curses()
|
|||
#endif /* USE_COLOR */
|
||||
#ifdef USE_MOUSE
|
||||
rb_define_module_function(mCurses, "getmouse", curses_getmouse, 0);
|
||||
rb_define_module_function(mCurses, "ungetmouse", curses_getmouse, 1);
|
||||
rb_define_module_function(mCurses, "ungetmouse", curses_ungetmouse, 1);
|
||||
rb_define_module_function(mCurses, "mouseinterval", curses_mouseinterval, 1);
|
||||
rb_define_module_function(mCurses, "mousemask", curses_mousemask, 1);
|
||||
#endif /* USE_MOUSE */
|
||||
|
@ -1489,14 +1489,12 @@ Init_curses()
|
|||
rb_define_method(cWindow, "keypad", window_keypad, 1);
|
||||
rb_define_method(cWindow, "keypad=", window_keypad, 1);
|
||||
|
||||
#ifdef USE_COLOR
|
||||
rb_define_method(cWindow, "attroff", window_attroff, 1);
|
||||
rb_define_method(cWindow, "attron", window_attron, 1);
|
||||
rb_define_method(cWindow, "attrset", window_attrset, 1);
|
||||
rb_define_method(cWindow, "bkgdset", window_bkgdset, 1);
|
||||
rb_define_method(cWindow, "bkgd", window_bkgd, 1);
|
||||
rb_define_method(cWindow, "getbkgd", window_getbkgd, 0);
|
||||
#endif /* USE_COLOR */
|
||||
|
||||
rb_define_method(cWindow, "nodelay=", window_nodelay, 1);
|
||||
rb_define_method(cWindow, "timeout=", window_timeout, 1);
|
||||
|
|
|
@ -426,7 +426,7 @@ iconv_convert
|
|||
}
|
||||
else {
|
||||
/* Some iconv() have a bug, return *outlen out of range */
|
||||
sprintf(errmsg, "bug?(output length = %d)", sizeof(buffer) - outlen);
|
||||
sprintf(errmsg, "bug?(output length = %ld)", sizeof(buffer) - outlen);
|
||||
error = rb_eIconvOutOfRange;
|
||||
}
|
||||
|
||||
|
@ -836,7 +836,6 @@ void
|
|||
Init_iconv _((void))
|
||||
{
|
||||
VALUE rb_cIconv = rb_define_class("Iconv", rb_cData);
|
||||
VALUE metaclass = RBASIC(rb_cIconv)->klass;
|
||||
|
||||
rb_define_alloc_func(rb_cIconv, iconv_s_allocate);
|
||||
rb_define_singleton_method(rb_cIconv, "open", iconv_s_open, 2);
|
||||
|
|
2
gc.c
2
gc.c
|
@ -579,7 +579,6 @@ void
|
|||
rb_gc_mark_locations(start, end)
|
||||
VALUE *start, *end;
|
||||
{
|
||||
VALUE *tmp;
|
||||
long n;
|
||||
|
||||
n = end - start;
|
||||
|
@ -655,7 +654,6 @@ gc_mark(ptr, lev)
|
|||
VALUE ptr;
|
||||
int lev;
|
||||
{
|
||||
int ret;
|
||||
register RVALUE *obj;
|
||||
|
||||
obj = RANY(ptr);
|
||||
|
|
3
io.c
3
io.c
|
@ -801,7 +801,6 @@ read_all(fptr, siz, str)
|
|||
siz += BUFSIZ;
|
||||
rb_str_resize(str, siz);
|
||||
}
|
||||
if (bytes == 0) return rb_str_new(0,0);
|
||||
if (bytes != siz) rb_str_resize(str, bytes);
|
||||
|
||||
return str;
|
||||
|
@ -3456,7 +3455,7 @@ rb_io_ctl(io, req, arg, io_p)
|
|||
rb_raise(rb_eArgError, "return value overflowed string");
|
||||
}
|
||||
|
||||
if (fptr->f2 && fileno(fptr->f) != fileno(fptr->f2)) {
|
||||
if (fptr->f2 && fileno(fptr->f) != fileno(fptr->f2)) {
|
||||
/* call on f2 too; ignore result */
|
||||
io_cntl(fileno(fptr->f2), cmd, narg, io_p);
|
||||
}
|
||||
|
|
|
@ -16,24 +16,24 @@ class WeakRef<Delegator
|
|||
class RefError<StandardError
|
||||
end
|
||||
|
||||
ID_MAP = {} # obj -> [ref,...]
|
||||
ID_REV_MAP = {} # ref -> obj
|
||||
@@id_map = {} # obj -> [ref,...]
|
||||
@@id_rev_map = {} # ref -> obj
|
||||
@@final = lambda{|id|
|
||||
__old_status = Thread.critical
|
||||
Thread.critical = true
|
||||
begin
|
||||
rids = ID_MAP[id]
|
||||
rids = @@id_map[id]
|
||||
if rids
|
||||
for rid in rids
|
||||
ID_REV_MAP.delete(rid)
|
||||
@@id_rev_map.delete(rid)
|
||||
end
|
||||
ID_MAP.delete(id)
|
||||
@@id_map.delete(id)
|
||||
end
|
||||
rid = ID_REV_MAP[id]
|
||||
rid = @@id_rev_map[id]
|
||||
if rid
|
||||
ID_REV_MAP.delete(id)
|
||||
ID_MAP[rid].delete(id)
|
||||
ID_MAP.delete(rid) if ID_MAP[rid].empty?
|
||||
@@id_rev_map.delete(id)
|
||||
@@id_map[rid].delete(id)
|
||||
@@id_map.delete(rid) if @@id_map[rid].empty?
|
||||
end
|
||||
ensure
|
||||
Thread.critical = __old_status
|
||||
|
@ -48,16 +48,16 @@ class WeakRef<Delegator
|
|||
__old_status = Thread.critical
|
||||
begin
|
||||
Thread.critical = true
|
||||
ID_MAP[@__id] = [] unless ID_MAP[@__id]
|
||||
@@id_map[@__id] = [] unless @@id_map[@__id]
|
||||
ensure
|
||||
Thread.critical = __old_status
|
||||
end
|
||||
ID_MAP[@__id].push self.__id__
|
||||
ID_REV_MAP[self.__id__] = @__id
|
||||
@@id_map[@__id].push self.__id__
|
||||
@@id_rev_map[self.__id__] = @__id
|
||||
end
|
||||
|
||||
def __getobj__
|
||||
unless ID_REV_MAP[self.__id__] == @__id
|
||||
unless @@id_rev_map[self.__id__] == @__id
|
||||
raise RefError, "Illegal Reference - probably recycled", caller(2)
|
||||
end
|
||||
begin
|
||||
|
@ -68,7 +68,7 @@ class WeakRef<Delegator
|
|||
end
|
||||
|
||||
def weakref_alive?
|
||||
ID_REV_MAP[self.__id__] == @__id
|
||||
@@id_rev_map[self.__id__] == @__id
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue