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

* io.c (rb_io_popen): do not call rb_io_close() directly, call

"close" method instead. [ruby-dev:19717]

* io.c (rb_io_s_open): ditto.

* hash.c (rb_any_hash): remove DEFER_INTS.  all do_hash() calls in
  st.c are at the top of functions.  No reentrant problem.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-03-04 07:04:11 +00:00
parent a38c2ac2dd
commit d37e836a58
5 changed files with 33 additions and 22 deletions

View file

@ -4,6 +4,16 @@ Tue Mar 4 15:08:08 2003 WATANABE Hirofumi <eban@ruby-lang.org>
* missing/strftime.c: ditto.
Tue Mar 4 10:11:32 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (rb_io_popen): do not call rb_io_close() directly, call
"close" method instead. [ruby-dev:19717]
* io.c (rb_io_s_open): ditto.
* hash.c (rb_any_hash): remove DEFER_INTS. all do_hash() calls in
st.c are at the top of functions. No reentrant problem.
Tue Mar 4 01:19:21 2003 Akinori MUSHA <knu@iDaemons.org>
* ext/dl/MANIFEST: Exclude .cvsignore. [found by: eban]
@ -569,6 +579,10 @@ Thu Jan 30 08:27:19 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* file.c (rb_file_s_expand_path): removed a sludge.
Wed Jan 29 03:24:39 2003 Michal Rokos <michal@rokos.homeip.net>
* dir.c (glob_helper): memory leak fixed.
Tue Jan 28 04:45:03 2003 Akinori MUSHA <knu@iDaemons.org>
* instruby.rb (parse_args), ext/extmk.rb (parse_args): Prepend a

1
dir.c
View file

@ -778,6 +778,7 @@ glob_helper(path, sub, flags, func, arg)
sprintf(buf, "%s%s%s", base, (BASE) ? "/" : "", dp->d_name);
if (lstat(buf, &st) < 0) {
if (errno != ENOENT) rb_sys_warning(buf);
free(buf);
continue;
}
if (S_ISDIR(st.st_mode)) {

6
hash.c
View file

@ -65,6 +65,8 @@ rb_any_cmp(a, b)
VALUE a, b;
{
VALUE args[2];
if (a == b) return 0;
if (FIXNUM_P(a) && FIXNUM_P(b)) {
return a != b;
}
@ -72,10 +74,10 @@ rb_any_cmp(a, b)
TYPE(b) == T_STRING && RBASIC(b)->klass == rb_cString) {
return rb_str_cmp(a, b);
}
if (a == Qundef || b == Qundef) return -1;
if (SYMBOL_P(a) && SYMBOL_P(b)) {
return a != b;
}
if (a == Qundef || b == Qundef) return -1;
args[0] = a;
args[1] = b;
@ -99,12 +101,10 @@ rb_any_hash(a)
break;
default:
DEFER_INTS;
hval = rb_funcall(a, id_hash, 0);
if (!FIXNUM_P(hval)) {
hval = rb_funcall(hval, '%', 1, INT2FIX(536870923));
}
ENABLE_INTS;
return (int)FIX2LONG(hval);
}
}

32
io.c
View file

@ -1421,6 +1421,12 @@ rb_io_close_m(io)
return Qnil;
}
static VALUE
io_close(io)
{
return rb_funcall(io, rb_intern("close"), 0, 0);
}
static VALUE
rb_io_closed(io)
VALUE io;
@ -2154,7 +2160,7 @@ rb_io_popen(str, argc, argv, klass)
}
RBASIC(port)->klass = klass;
if (rb_block_given_p()) {
return rb_ensure(rb_yield, port, rb_io_close, port);
return rb_ensure(rb_yield, port, io_close, port);
}
return port;
}
@ -2209,7 +2215,7 @@ rb_io_s_open(argc, argv, klass)
VALUE io = rb_class_new_instance(argc, argv, klass);
if (rb_block_given_p()) {
return rb_ensure(rb_yield, io, rb_io_close, io);
return rb_ensure(rb_yield, io, io_close, io);
}
return io;
@ -2999,16 +3005,6 @@ next_argv()
return Qtrue;
}
static void
any_close(file)
VALUE file;
{
if (TYPE(file) == T_FILE)
rb_io_close(file);
else
rb_funcall3(file, rb_intern("close"), 0, 0);
}
static VALUE
argf_getline(argc, argv)
int argc;
@ -3039,7 +3035,7 @@ argf_getline(argc, argv)
line = rb_io_getline(rs, fptr);
}
if (NIL_P(line) && next_p != -1) {
any_close(current_file);
io_close(current_file);
next_p = 1;
goto retry;
}
@ -3074,7 +3070,7 @@ rb_gets()
if (!next_argv()) return Qnil;
line = rb_io_gets(current_file);
if (NIL_P(line) && next_p != -1) {
any_close(current_file);
io_close(current_file);
next_p = 1;
goto retry;
}
@ -3725,7 +3721,7 @@ argf_read(argc, argv)
tmp = io_read(argc, argv, current_file);
}
if (NIL_P(tmp) && next_p != -1) {
any_close(current_file);
io_close(current_file);
next_p = 1;
goto retry;
}
@ -3758,7 +3754,7 @@ argf_getc()
byte = rb_io_getc(current_file);
}
if (NIL_P(byte) && next_p != -1) {
any_close(current_file);
io_close(current_file);
next_p = 1;
goto retry;
}
@ -3850,7 +3846,7 @@ static VALUE
argf_skip()
{
if (next_p != -1) {
any_close(current_file);
io_close(current_file);
next_p = 1;
}
return argf;
@ -3859,7 +3855,7 @@ argf_skip()
static VALUE
argf_close()
{
any_close(current_file);
io_close(current_file);
if (next_p != -1) {
next_p = 1;
}

View file

@ -497,7 +497,7 @@ status:
$stderr.printf("name:%s value:%s\n", name, value) if $DEBUG
case name
when 'Set-Cookie'
table.add($1, $2)
table.add(name, value)
when /^status$/ni
Apache::request.status_line = value
Apache::request.status = value.to_i