зеркало из https://github.com/github/ruby.git
* object.c (inspect_obj): unintended space removal.
[ruby-dev:25810] * eval.c (rb_exec_recursive): should not use NODE in disclosed context. [ruby-dev:25812] * io.c (rb_f_open): need not to check if to_open value is a T_FILE. [ruby-dev:25812] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
57b3ed4cda
Коммит
6645b92826
|
@ -10,6 +10,7 @@
|
|||
COPYING.LIB
|
||||
ChangeLog.pre-alpha
|
||||
ChangeLog.pre1_1
|
||||
ChangeLog-1.8.0
|
||||
Makefile
|
||||
README.fat-patch
|
||||
README.v6
|
||||
|
|
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Mon Mar 7 10:28:00 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* object.c (inspect_obj): unintended space removal.
|
||||
[ruby-dev:25810]
|
||||
|
||||
* eval.c (rb_exec_recursive): should not use NODE in disclosed
|
||||
context. [ruby-dev:25812]
|
||||
|
||||
* io.c (rb_f_open): need not to check if to_open value is a
|
||||
T_FILE. [ruby-dev:25812]
|
||||
|
||||
Mon Mar 7 01:21:01 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* ext/tk/tkutil/tkutil.c: follow the change of st.c (committed
|
||||
|
|
86
eval.c
86
eval.c
|
@ -12991,49 +12991,83 @@ rb_throw(tag, val)
|
|||
rb_f_throw(2, argv);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
recursive_check(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
VALUE hash = rb_thread_local_aref(rb_thread_current(), recursive_key);
|
||||
|
||||
if (NIL_P(hash) || TYPE(hash) != T_HASH) {
|
||||
return Qfalse;
|
||||
}
|
||||
else {
|
||||
VALUE list = rb_hash_aref(hash, ID2SYM(ruby_frame->this_func));
|
||||
|
||||
if (NIL_P(list)) return Qfalse;
|
||||
return rb_ary_includes(list, rb_obj_id(obj));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
recursive_push(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
VALUE hash = rb_thread_local_aref(rb_thread_current(), recursive_key);
|
||||
VALUE list, sym;
|
||||
|
||||
sym = ID2SYM(ruby_frame->this_func);
|
||||
if (NIL_P(hash) || TYPE(hash) != T_HASH) {
|
||||
hash = rb_hash_new();
|
||||
rb_thread_local_aset(rb_thread_current(), recursive_key, hash);
|
||||
list = Qnil;
|
||||
}
|
||||
else {
|
||||
list = rb_hash_aref(hash, sym);
|
||||
}
|
||||
if (NIL_P(list)) {
|
||||
list = rb_ary_new();
|
||||
rb_hash_aset(hash, sym, list);
|
||||
}
|
||||
rb_ary_push(list, rb_obj_id(obj));
|
||||
}
|
||||
|
||||
static void
|
||||
recursive_pop()
|
||||
{
|
||||
VALUE hash = rb_thread_local_aref(rb_thread_current(), recursive_key);
|
||||
VALUE list, sym;
|
||||
|
||||
sym = ID2SYM(ruby_frame->this_func);
|
||||
if (NIL_P(hash) || TYPE(hash) != T_HASH) {
|
||||
rb_bug("invalid inspect_tbl hash");
|
||||
}
|
||||
list = rb_hash_aref(hash, sym);
|
||||
if (NIL_P(list) || TYPE(list) != T_ARRAY) {
|
||||
rb_bug("invalid inspect_tbl list");
|
||||
}
|
||||
rb_ary_pop(list);
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_exec_recursive(func, obj, arg)
|
||||
VALUE (*func)(ANYARGS); /* VALUE obj, VALUE arg, int flag */
|
||||
VALUE obj, arg;
|
||||
{
|
||||
VALUE list = rb_thread_local_aref(rb_thread_current(), recursive_key);
|
||||
int found = Qfalse;
|
||||
|
||||
if (NIL_P(list) || TYPE(list) != T_NODE) {
|
||||
list = Qnil;
|
||||
}
|
||||
else {
|
||||
NODE *tmp = (NODE*)list;
|
||||
|
||||
while (!NIL_P(tmp)) {
|
||||
if (tmp->nd_cfnc == func && tmp->nd_tval == obj) {
|
||||
found = Qtrue;
|
||||
break;
|
||||
}
|
||||
tmp = tmp->nd_next;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
if (recursive_check(obj)) {
|
||||
return (*func)(obj, arg, Qtrue);
|
||||
}
|
||||
else {
|
||||
NODE *node = rb_node_newnode(NODE_MEMO, (VALUE)func, obj, list);
|
||||
recursive_push(obj);
|
||||
VALUE result;
|
||||
int state;
|
||||
|
||||
rb_thread_local_aset(rb_thread_current(), recursive_key, (VALUE)node);
|
||||
PUSH_TAG(PROT_NONE);
|
||||
if ((state = EXEC_TAG()) == 0) {
|
||||
result = (*func)(obj, arg, Qfalse);
|
||||
}
|
||||
POP_TAG();
|
||||
recursive_pop();
|
||||
if (state) JUMP_TAG(state);
|
||||
|
||||
/* remove pushed tag */
|
||||
list = rb_thread_local_aref(rb_thread_current(), recursive_key);
|
||||
node = (NODE*)list;
|
||||
|
||||
rb_thread_local_aset(rb_thread_current(), recursive_key, (VALUE)node->nd_next);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
3
io.c
3
io.c
|
@ -3277,9 +3277,6 @@ rb_f_open(argc, argv)
|
|||
if (rb_respond_to(argv[0], to_open)) {
|
||||
VALUE io = rb_funcall2(argv[0], to_open, argc-1, argv+1);
|
||||
|
||||
if (TYPE(io) != T_FILE) {
|
||||
rb_raise(rb_eTypeError, "to_open should return IO value");
|
||||
}
|
||||
if (rb_block_given_p()) {
|
||||
return rb_ensure(rb_yield, io, io_close, io);
|
||||
}
|
||||
|
|
|
@ -155,8 +155,8 @@ class CGI
|
|||
#
|
||||
class Session
|
||||
|
||||
#:nodoc:
|
||||
class NoSession < RuntimeError; end
|
||||
class NoSession < RuntimeError #:nodoc:
|
||||
end
|
||||
|
||||
# The id of this session.
|
||||
attr_reader :session_id, :new_session
|
||||
|
|
24
lib/pp.rb
24
lib/pp.rb
|
@ -95,19 +95,29 @@ class PP < PrettyPrint
|
|||
|
||||
def guard_inspect_key
|
||||
if Thread.current[InspectKey] == nil
|
||||
Thread.current[InspectKey] = []
|
||||
Thread.current[InspectKey] = {inspect: []}
|
||||
end
|
||||
|
||||
save = Thread.current[InspectKey]
|
||||
save = Thread.current[InspectKey][:inspect]
|
||||
|
||||
begin
|
||||
Thread.current[InspectKey] = []
|
||||
Thread.current[InspectKey][:inspect] = []
|
||||
yield
|
||||
ensure
|
||||
Thread.current[InspectKey] = save
|
||||
Thread.current[InspectKey][:inspect] = save
|
||||
end
|
||||
end
|
||||
|
||||
def check_inspect_key(id)
|
||||
Thread.current[InspectKey][:inspect].include?(id)
|
||||
end
|
||||
def push_inspect_key(id)
|
||||
Thread.current[InspectKey][:inspect] << id
|
||||
end
|
||||
def pop_inspect_key
|
||||
Thread.current[InspectKey][:inspect].pop
|
||||
end
|
||||
|
||||
# Adds +obj+ to the pretty printing buffer
|
||||
# using Object#pretty_print or Object#pretty_print_cycle.
|
||||
#
|
||||
|
@ -116,16 +126,16 @@ class PP < PrettyPrint
|
|||
def pp(obj)
|
||||
id = obj.__id__
|
||||
|
||||
if Thread.current[InspectKey].include? id
|
||||
if check_inspect_key(id)
|
||||
group {obj.pretty_print_cycle self}
|
||||
return
|
||||
end
|
||||
|
||||
begin
|
||||
Thread.current[InspectKey] << id
|
||||
push_inspect_key(id)
|
||||
group {obj.pretty_print self}
|
||||
ensure
|
||||
Thread.current[InspectKey].pop unless PP.sharing_detection
|
||||
pop_inspect_key unless PP.sharing_detection
|
||||
end
|
||||
end
|
||||
|
||||
|
|
2
object.c
2
object.c
|
@ -350,7 +350,7 @@ inspect_obj(obj, str, recur)
|
|||
int recur;
|
||||
{
|
||||
if (recur) {
|
||||
rb_str_cat2(str, "...");
|
||||
rb_str_cat2(str, " ...");
|
||||
}
|
||||
else {
|
||||
st_foreach_safe(ROBJECT(obj)->iv_tbl, inspect_i, str);
|
||||
|
|
|
@ -85,18 +85,18 @@ class AuthHeaderPortServer < SOAP::RPC::CGIStub
|
|||
end
|
||||
|
||||
def on_simple_inbound(my_header, mu)
|
||||
auth = false
|
||||
auth_p = false
|
||||
userid = my_header["userid"]
|
||||
passwd = my_header["passwd"]
|
||||
if login(userid, passwd)
|
||||
auth = true
|
||||
auth_p = true
|
||||
elsif sessionid = my_header["sessionid"]
|
||||
if userid = auth(sessionid)
|
||||
destroy_session(sessionid)
|
||||
auth = true
|
||||
auth_p = true
|
||||
end
|
||||
end
|
||||
raise RuntimeError.new("authentication failed") unless auth
|
||||
raise RuntimeError.new("authentication failed") unless auth_p
|
||||
@userid = userid
|
||||
@sessionid = create_session(userid)
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче