Skip to content

Commit f449c04

Browse files
author
matz
committed
* 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
1 parent 6395c3b commit f449c04

File tree

7 files changed

+23
-26
lines changed

7 files changed

+23
-26
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Wed Dec 10 17:17:18 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
2+
3+
* io.c (read_all): should return given string even if data read is
4+
empty. [ruby-dev:22207]
5+
16
Wed Dec 10 17:16:06 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
27

38
* ext/stringio/stringio.c (strio_read): adjust behavior at reading

error.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,6 @@ syserr_eqq(self, exc)
642642
return Qfalse;
643643
}
644644

645-
static void init_syserr _((void));
646-
647645
void
648646
Init_Exception()
649647
{

ext/curses/curses.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ curses_pair_number(VALUE obj, VALUE attrs)
621621
{
622622
return INT2FIX(PAIR_NUMBER(NUM2INT(attrs)));
623623
}
624-
#endif
624+
#endif /* USE_COLOR */
625625

626626
#ifdef USE_MOUSE
627627
struct mousedata {
@@ -1443,7 +1443,7 @@ Init_curses()
14431443
#endif /* USE_COLOR */
14441444
#ifdef USE_MOUSE
14451445
rb_define_module_function(mCurses, "getmouse", curses_getmouse, 0);
1446-
rb_define_module_function(mCurses, "ungetmouse", curses_getmouse, 1);
1446+
rb_define_module_function(mCurses, "ungetmouse", curses_ungetmouse, 1);
14471447
rb_define_module_function(mCurses, "mouseinterval", curses_mouseinterval, 1);
14481448
rb_define_module_function(mCurses, "mousemask", curses_mousemask, 1);
14491449
#endif /* USE_MOUSE */
@@ -1489,14 +1489,12 @@ Init_curses()
14891489
rb_define_method(cWindow, "keypad", window_keypad, 1);
14901490
rb_define_method(cWindow, "keypad=", window_keypad, 1);
14911491

1492-
#ifdef USE_COLOR
14931492
rb_define_method(cWindow, "attroff", window_attroff, 1);
14941493
rb_define_method(cWindow, "attron", window_attron, 1);
14951494
rb_define_method(cWindow, "attrset", window_attrset, 1);
14961495
rb_define_method(cWindow, "bkgdset", window_bkgdset, 1);
14971496
rb_define_method(cWindow, "bkgd", window_bkgd, 1);
14981497
rb_define_method(cWindow, "getbkgd", window_getbkgd, 0);
1499-
#endif /* USE_COLOR */
15001498

15011499
rb_define_method(cWindow, "nodelay=", window_nodelay, 1);
15021500
rb_define_method(cWindow, "timeout=", window_timeout, 1);

ext/iconv/iconv.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ iconv_convert
426426
}
427427
else {
428428
/* Some iconv() have a bug, return *outlen out of range */
429-
sprintf(errmsg, "bug?(output length = %d)", sizeof(buffer) - outlen);
429+
sprintf(errmsg, "bug?(output length = %ld)", sizeof(buffer) - outlen);
430430
error = rb_eIconvOutOfRange;
431431
}
432432

@@ -836,7 +836,6 @@ void
836836
Init_iconv _((void))
837837
{
838838
VALUE rb_cIconv = rb_define_class("Iconv", rb_cData);
839-
VALUE metaclass = RBASIC(rb_cIconv)->klass;
840839

841840
rb_define_alloc_func(rb_cIconv, iconv_s_allocate);
842841
rb_define_singleton_method(rb_cIconv, "open", iconv_s_open, 2);

gc.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,6 @@ void
579579
rb_gc_mark_locations(start, end)
580580
VALUE *start, *end;
581581
{
582-
VALUE *tmp;
583582
long n;
584583

585584
n = end - start;
@@ -655,7 +654,6 @@ gc_mark(ptr, lev)
655654
VALUE ptr;
656655
int lev;
657656
{
658-
int ret;
659657
register RVALUE *obj;
660658

661659
obj = RANY(ptr);

io.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,6 @@ read_all(fptr, siz, str)
801801
siz += BUFSIZ;
802802
rb_str_resize(str, siz);
803803
}
804-
if (bytes == 0) return rb_str_new(0,0);
805804
if (bytes != siz) rb_str_resize(str, bytes);
806805

807806
return str;
@@ -3456,7 +3455,7 @@ rb_io_ctl(io, req, arg, io_p)
34563455
rb_raise(rb_eArgError, "return value overflowed string");
34573456
}
34583457

3459-
if (fptr->f2 && fileno(fptr->f) != fileno(fptr->f2)) {
3458+
if (fptr->f2 && fileno(fptr->f) != fileno(fptr->f2)) {
34603459
/* call on f2 too; ignore result */
34613460
io_cntl(fileno(fptr->f2), cmd, narg, io_p);
34623461
}

lib/weakref.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,24 @@ class WeakRef<Delegator
1616
class RefError<StandardError
1717
end
1818

19-
ID_MAP = {} # obj -> [ref,...]
20-
ID_REV_MAP = {} # ref -> obj
19+
@@id_map = {} # obj -> [ref,...]
20+
@@id_rev_map = {} # ref -> obj
2121
@@final = lambda{|id|
2222
__old_status = Thread.critical
2323
Thread.critical = true
2424
begin
25-
rids = ID_MAP[id]
25+
rids = @@id_map[id]
2626
if rids
2727
for rid in rids
28-
ID_REV_MAP.delete(rid)
28+
@@id_rev_map.delete(rid)
2929
end
30-
ID_MAP.delete(id)
30+
@@id_map.delete(id)
3131
end
32-
rid = ID_REV_MAP[id]
32+
rid = @@id_rev_map[id]
3333
if rid
34-
ID_REV_MAP.delete(id)
35-
ID_MAP[rid].delete(id)
36-
ID_MAP.delete(rid) if ID_MAP[rid].empty?
34+
@@id_rev_map.delete(id)
35+
@@id_map[rid].delete(id)
36+
@@id_map.delete(rid) if @@id_map[rid].empty?
3737
end
3838
ensure
3939
Thread.critical = __old_status
@@ -48,16 +48,16 @@ def initialize(orig)
4848
__old_status = Thread.critical
4949
begin
5050
Thread.critical = true
51-
ID_MAP[@__id] = [] unless ID_MAP[@__id]
51+
@@id_map[@__id] = [] unless @@id_map[@__id]
5252
ensure
5353
Thread.critical = __old_status
5454
end
55-
ID_MAP[@__id].push self.__id__
56-
ID_REV_MAP[self.__id__] = @__id
55+
@@id_map[@__id].push self.__id__
56+
@@id_rev_map[self.__id__] = @__id
5757
end
5858

5959
def __getobj__
60-
unless ID_REV_MAP[self.__id__] == @__id
60+
unless @@id_rev_map[self.__id__] == @__id
6161
raise RefError, "Illegal Reference - probably recycled", caller(2)
6262
end
6363
begin
@@ -68,7 +68,7 @@ def __getobj__
6868
end
6969

7070
def weakref_alive?
71-
ID_REV_MAP[self.__id__] == @__id
71+
@@id_rev_map[self.__id__] == @__id
7272
end
7373
end
7474

0 commit comments

Comments
 (0)