* eval.c (proc_save_safe_level): no need to restrict safe level

memoize in $SAFE>=3.  [ruby-dev:27050]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2005-09-12 16:21:50 +00:00
Родитель 35a84adff0
Коммит 82e8e747df
5 изменённых файлов: 14 добавлений и 12 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Tue Sep 13 01:17:45 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (proc_save_safe_level): no need to restrict safe level
memoize in $SAFE>=3. [ruby-dev:27050]
Tue Sep 13 00:02:33 2005 Nobuyoshi Nakada <nobu@ruby-lang.org> Tue Sep 13 00:02:33 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* file.c (apply2files): stricter callback definition. * file.c (apply2files): stricter callback definition.

2
eval.c
Просмотреть файл

@ -7968,12 +7968,10 @@ bind_eval(int argc, VALUE *argv, VALUE bind)
static void static void
proc_save_safe_level(VALUE data) proc_save_safe_level(VALUE data)
{ {
if (ruby_safe_level >= 3) {
int safe = ruby_safe_level; int safe = ruby_safe_level;
if (safe > PROC_TMAX) safe = PROC_TMAX; if (safe > PROC_TMAX) safe = PROC_TMAX;
FL_SET(data, (safe << PROC_TSHIFT) & PROC_TMASK); FL_SET(data, (safe << PROC_TSHIFT) & PROC_TMASK);
} }
}
static int static int
proc_get_safe_level(VALUE data) proc_get_safe_level(VALUE data)

Просмотреть файл

@ -19,7 +19,7 @@ class TestBasicSocket < Test::Unit::TestCase
n = s.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR) n = s.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR)
assert_equal([0].pack("i"), n) assert_equal([0].pack("i"), n)
val = Object.new val = Object.new
class << val; self end.send(:define_method, :to_int) { class << val; self end.fcall(:define_method, :to_int) {
s.close s.close
Socket::SO_TYPE Socket::SO_TYPE
} }
@ -34,7 +34,7 @@ class TestBasicSocket < Test::Unit::TestCase
linger = [0, 0].pack("ii") linger = [0, 0].pack("ii")
val = Object.new val = Object.new
class << val; self end.send(:define_method, :to_str) { class << val; self end.fcall(:define_method, :to_str) {
s.close s.close
linger linger
} }
@ -47,7 +47,7 @@ class TestBasicSocket < Test::Unit::TestCase
end end
val = Object.new val = Object.new
class << val; self end.send(:define_method, :to_int) { class << val; self end.fcall(:define_method, :to_int) {
s.close s.close
Socket::SO_LINGER Socket::SO_LINGER
} }
@ -61,7 +61,7 @@ class TestBasicSocket < Test::Unit::TestCase
def test_listen def test_listen
s = nil s = nil
log = Object.new log = Object.new
class << log; self end.send(:define_method, :to_int) { class << log; self end.fcall(:define_method, :to_int) {
s.close s.close
2 2
} }

Просмотреть файл

@ -9,7 +9,7 @@ class TestUDPSocket < Test::Unit::TestCase
def test_connect # [ruby-dev:25045] def test_connect # [ruby-dev:25045]
s = UDPSocket.new s = UDPSocket.new
host = Object.new host = Object.new
class << host; self end.send(:define_method, :to_str) { class << host; self end.fcall(:define_method, :to_str) {
s.close s.close
"127.0.0.1" "127.0.0.1"
} }
@ -21,7 +21,7 @@ class TestUDPSocket < Test::Unit::TestCase
def test_bind # [ruby-dev:25057] def test_bind # [ruby-dev:25057]
s = UDPSocket.new s = UDPSocket.new
host = Object.new host = Object.new
class << host; self end.send(:define_method, :to_str) { class << host; self end.fcall(:define_method, :to_str) {
s.close s.close
"127.0.0.1" "127.0.0.1"
} }

Просмотреть файл

@ -483,7 +483,6 @@ Message: <"Error">
def test_assert_send def test_assert_send
object = Object.new object = Object.new
class << object class << object
private
def return_argument(argument, bogus) def return_argument(argument, bogus)
return argument return argument
end end