* gc.c, parse.y, lib/cgi.rb, lib/date.rb: last minute backports from HEAD.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2004-07-14 14:22:11 +00:00
parent 91c9ac216a
commit 6e918be6b1
5 changed files with 23 additions and 17 deletions

2
gc.c
View file

@ -1434,7 +1434,7 @@ Init_stack(addr)
STACK_LEVEL_MAX = (rlim.rlim_cur - space) / sizeof(VALUE); STACK_LEVEL_MAX = (rlim.rlim_cur - space) / sizeof(VALUE);
} }
} }
#ifdef __ia64__ #if defined(__ia64__) && (!defined(__GNUC__) || __GNUC__ < 2 || defined(__OPTIMIZE__))
/* ruby crashes on IA64 if compiled with optimizer on */ /* ruby crashes on IA64 if compiled with optimizer on */
/* when if STACK_LEVEL_MAX is greater than this magic number */ /* when if STACK_LEVEL_MAX is greater than this magic number */
/* I know this is a kludge. I suspect optimizer bug */ /* I know this is a kludge. I suspect optimizer bug */

View file

@ -1125,17 +1125,16 @@ class CGI
@multipart @multipart
end end
class Value < DelegateClass(String) # :nodoc: module Value # :nodoc:
def initialize(str, params) def set_params(params)
@params = params @params = params
super(str)
end end
def [](idx, *args) def [](idx, *args)
if args.size == 0 if args.size == 0
warn "#{caller(1)[0]}:CAUTION! cgi['key'] == cgi.params['key'][0]; if want Array, use cgi.params['key']" warn "#{caller(1)[0]}:CAUTION! cgi['key'] == cgi.params['key'][0]; if want Array, use cgi.params['key']"
self @params[idx]
else else
self.to_s[idx,*args] super[idx,*args]
end end
end end
def first def first
@ -1165,7 +1164,10 @@ class CGI
Tempfile.new("CGI") Tempfile.new("CGI")
end end
else else
Value.new(value || "", params) str = if value then value.dup else "" end
str.extend(Value)
str.set_params(params)
str
end end
end end
@ -2310,4 +2312,3 @@ class CGI
end end
end # class CGI end # class CGI

View file

@ -210,7 +210,7 @@ class CGI
# #
# session_expires:: the time the current session expires, as a # session_expires:: the time the current session expires, as a
# +Time+ object. If not set, the session will terminate # +Time+ object. If not set, the session will terminate
# when the user's browser is closed. # when the user's browser is closed.
# session_domain:: the hostname domain for which this session is valid. # session_domain:: the hostname domain for which this session is valid.
# If not set, defaults to the hostname of the server. # If not set, defaults to the hostname of the server.
# session_secure:: if +true+, this session will only work over HTTPS. # session_secure:: if +true+, this session will only work over HTTPS.
@ -365,7 +365,6 @@ class CGI
raise ArgumentError, "session_id `%s' is invalid" % id raise ArgumentError, "session_id `%s' is invalid" % id
end end
@path = dir+"/"+prefix+id @path = dir+"/"+prefix+id
@path.untaint
unless File::exist? @path unless File::exist? @path
@hash = {} @hash = {}
end end
@ -413,7 +412,8 @@ class CGI
# Close and delete the session's FileStore file. # Close and delete the session's FileStore file.
def delete def delete
File::unlink @path File::unlink @path
rescue Errno::ENOENT
end end
end end

View file

@ -711,7 +711,13 @@ class Date
alias_method :__#{id.to_i}__, :#{id.to_s} alias_method :__#{id.to_i}__, :#{id.to_s}
private :__#{id.to_i}__ private :__#{id.to_i}__
def #{id.to_s}(*args, &block) def #{id.to_s}(*args, &block)
(@__#{id.to_i}__ ||= [__#{id.to_i}__(*args, &block)])[0] if @__#{id.to_i}__
@__#{id.to_i}__
elsif ! self.frozen?
@__#{id.to_i}__ ||= __#{id.to_i}__(*args, &block)
else
__#{id.to_i}__(*args, &block)
end
end end
end; end;
end end

View file

@ -5266,11 +5266,10 @@ static NODE*
cond0(node) cond0(node)
NODE *node; NODE *node;
{ {
enum node_type type = nd_type(node); if (node == 0) return 0;
assign_in_cond(node); assign_in_cond(node);
switch (type) { switch (nd_type(node)) {
case NODE_DSTR: case NODE_DSTR:
case NODE_EVSTR: case NODE_EVSTR:
case NODE_STR: case NODE_STR:
@ -5294,8 +5293,8 @@ cond0(node)
case NODE_DOT3: case NODE_DOT3:
node->nd_beg = range_op(node->nd_beg); node->nd_beg = range_op(node->nd_beg);
node->nd_end = range_op(node->nd_end); node->nd_end = range_op(node->nd_end);
if (type == NODE_DOT2) nd_set_type(node,NODE_FLIP2); if (nd_type(node) == NODE_DOT2) nd_set_type(node,NODE_FLIP2);
else if (type == NODE_DOT3) nd_set_type(node, NODE_FLIP3); else if (nd_type(node) == NODE_DOT3) nd_set_type(node, NODE_FLIP3);
node->nd_cnt = local_append(internal_id()); node->nd_cnt = local_append(internal_id());
if (!e_option_supplied()) { if (!e_option_supplied()) {
int b = literal_node(node->nd_beg); int b = literal_node(node->nd_beg);