Skip to content

Commit 87ba614

Browse files
author
matz
committed
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent c4e554c commit 87ba614

File tree

5 files changed

+36
-5
lines changed

5 files changed

+36
-5
lines changed

ChangeLog

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
Tue Aug 15 17:30:59 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
2+
3+
* eval.c (frame_dup): should set flag FRAME_MALLOC after
4+
argv allocation.
5+
6+
* eval.c (blk_free): should not free argv if GC was called before
7+
frame_dup.
8+
9+
Tue Aug 15 01:45:28 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
10+
11+
* io.c (argf_eof): should return true at the end of ARGF without
12+
checking stdout if arguments are given.
13+
14+
Mon Aug 14 10:34:32 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
15+
16+
* eval.c (rb_thread_status): status should return false for normal
17+
termination, nil for termination by exception.
18+
119
Wed Aug 9 13:24:25 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
220

321
* win32/win32.[ch]: emulate rename(2).

env.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@ extern struct FRAME {
2222
char *file;
2323
int line;
2424
int iter;
25+
int flags;
2526
} *ruby_frame;
2627

2728
void rb_gc_mark_frame _((struct FRAME *));
2829

30+
#define FRAME_ALLOCA 0
31+
#define FRAME_MALLOC 1
32+
2933
extern struct SCOPE {
3034
struct RBasic super;
3135
ID *local_tbl;

eval.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ static struct SCOPE *top_scope;
429429
_frame.cbase = ruby_frame->cbase; \
430430
_frame.argc = 0; \
431431
_frame.argv = 0; \
432+
_frame.flags = FRAME_ALLOCA; \
432433
ruby_frame = &_frame; \
433434

434435
#define POP_FRAME() \
@@ -5488,7 +5489,7 @@ blk_free(data)
54885489

54895490
frame = data->frame.prev;
54905491
while (frame) {
5491-
if (frame->argc > 0)
5492+
if (frame->argc > 0 && (frame->flags & FRAME_MALLOC))
54925493
free(frame->argv);
54935494
tmp = frame;
54945495
frame = frame->prev;
@@ -5534,6 +5535,7 @@ frame_dup(frame)
55345535
argv = ALLOC_N(VALUE, frame->argc);
55355536
MEMCPY(argv, frame->argv, VALUE, frame->argc);
55365537
frame->argv = argv;
5538+
frame->flags = FRAME_MALLOC;
55375539
}
55385540
frame->tmp = 0; /* should not preserve tmp */
55395541
if (!frame->prev) break;
@@ -7259,9 +7261,9 @@ rb_thread_status(thread)
72597261
rb_thread_t th = rb_thread_check(thread);
72607262

72617263
if (rb_thread_dead(th)) {
7262-
if (NIL_P(th->errinfo) && (th->flags & THREAD_RAISED))
7263-
return Qfalse;
7264-
return Qnil;
7264+
if (!NIL_P(th->errinfo) && (th->flags & THREAD_RAISED))
7265+
return Qnil;
7266+
return Qfalse;
72657267
}
72667268

72677269
return Qtrue;

io.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ struct timeval rb_time_interval _((VALUE));
9898

9999
static VALUE filename, current_file;
100100
static int gets_lineno;
101-
static int init_p = 0, next_p = 0;
101+
static int init_p = 0, next_p = 0, first_p = 1;
102102
static VALUE lineno;
103103

104104
#ifdef _STDIO_USES_IOSTREAM /* GNU libc */
@@ -2274,6 +2274,7 @@ next_argv()
22742274
current_file = rb_stdin;
22752275
}
22762276
init_p = 1;
2277+
first_p = 0;
22772278
gets_lineno = 0;
22782279
}
22792280

@@ -3084,8 +3085,13 @@ argf_readchar()
30843085
static VALUE
30853086
argf_eof()
30863087
{
3088+
int first = first_p;
3089+
30873090
if (init_p == 0 && !next_argv())
30883091
return Qtrue;
3092+
if (!first && next_p == -1) {
3093+
return Qtrue;
3094+
}
30893095
if (TYPE(current_file) != T_FILE) {
30903096
return argf_forward();
30913097
}

lib/net/ftp.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ def transfercmd(cmd)
203203
raise FTPReplyError, resp
204204
end
205205
conn = sock.accept
206+
sock.close
206207
end
207208
return conn
208209
end

0 commit comments

Comments
 (0)