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

* numeric.c (flo_eq): alway check if operands are NaN.

[ruby-list:39685]

* lib/cgi/session.rb: use LOCK_SH to read, and a few other
  improvements.  [ruby-core:02328]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2004-05-20 04:34:14 +00:00
parent 5345d52ff6
commit a6a8847190
8 changed files with 44 additions and 28 deletions

View file

@ -1,3 +1,8 @@
Thu May 20 12:38:06 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* numeric.c (flo_eq): alway check if operands are NaN.
[ruby-list:39685]
Thu May 20 12:34:39 2004 Dave Thomas <dave@pragprog.com> Thu May 20 12:34:39 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_visibility): * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_visibility):
@ -2645,6 +2650,11 @@ Wed Jan 28 12:43:07 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/rss: rss library imported. [ruby-dev:22726] * lib/rss: rss library imported. [ruby-dev:22726]
Wed Jan 28 04:29:41 2004 Eric Schwartz <emschwar@fc.hp.com>
* lib/cgi/session.rb: use LOCK_SH to read, and a few other
improvements. [ruby-core:02328]
Tue Jan 27 15:00:14 2004 Yukihiro Matsumoto <matz@ruby-lang.org> Tue Jan 27 15:00:14 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* misc/ruby-mode.el: better support for general delimited * misc/ruby-mode.el: better support for general delimited

View file

@ -354,6 +354,8 @@ freebsd*) LIBS="-lm $LIBS"
;; ;;
bow) ac_cv_func_setitimer=no bow) ac_cv_func_setitimer=no
;; ;;
superux*) ac_cv_func_setitimer=no
;;
*) LIBS="-lm $LIBS";; *) LIBS="-lm $LIBS";;
esac esac
AC_CHECK_LIB(crypt, crypt) AC_CHECK_LIB(crypt, crypt)

View file

@ -56,6 +56,9 @@
#endif #endif
#include <netdb.h> #include <netdb.h>
#if defined(HAVE_RESOLV_H) #if defined(HAVE_RESOLV_H)
#ifdef _SX
#include <stdio.h>
#endif
#include <resolv.h> #include <resolv.h>
#endif #endif
#include <unistd.h> #include <unistd.h>

View file

@ -51,6 +51,9 @@
#endif #endif
#include <netdb.h> #include <netdb.h>
#if defined(HAVE_RESOLV_H) #if defined(HAVE_RESOLV_H)
#ifdef _SX
#include <stdio.h>
#endif
#include <resolv.h> #include <resolv.h>
#endif #endif
#endif #endif

View file

@ -1132,6 +1132,7 @@ make_hostent_internal(arg)
rb_ary_push(ary, names); rb_ary_push(ary, names);
rb_ary_push(ary, INT2NUM(addr->ai_family)); rb_ary_push(ary, INT2NUM(addr->ai_family));
for (ai = addr; ai; ai = ai->ai_next) { for (ai = addr; ai; ai = ai->ai_next) {
printf("SA_LEN(%d)=%d\n", ai->ai_addrlen, SA_LEN(ai->ai_addr));
rb_ary_push(ary, (*ipaddr)(ai->ai_addr, ai->ai_addrlen)); rb_ary_push(ary, (*ipaddr)(ai->ai_addr, ai->ai_addrlen));
} }

View file

@ -364,16 +364,11 @@ class CGI
unless check_id(id) unless check_id(id)
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 @path.untaint
unless File::exist? path unless File::exist? @path
@hash = {} @hash = {}
end end
begin
@f = open(path, "r+")
rescue Errno::ENOENT
@f = open(path, "w+")
end
end end
# Restore session state from the session's FileStore file. # Restore session state from the session's FileStore file.
@ -382,13 +377,17 @@ class CGI
def restore def restore
unless @hash unless @hash
@hash = {} @hash = {}
@f.flock File::LOCK_EX begin
@f.rewind f = File.open(@path, 'r')
for line in @f f.flock File::LOCK_SH
line.chomp! for line in f
k, v = line.split('=',2) line.chomp!
@hash[CGI::unescape(k)] = CGI::unescape(v) k, v = line.split('=',2)
end @hash[CGI::unescape(k)] = CGI::unescape(v)
end
ensure
f.close unless f.nil?
end
end end
@hash @hash
end end
@ -396,25 +395,25 @@ class CGI
# Save session state to the session's FileStore file. # Save session state to the session's FileStore file.
def update def update
return unless @hash return unless @hash
@f.rewind begin
for k,v in @hash f = File.open(@path, 'w')
@f.printf "%s=%s\n", CGI::escape(k), CGI::escape(String(v)) f.flock File::LOCK_EX
end for k,v in @hash
@f.truncate @f.tell f.printf "%s=%s\n", CGI::escape(k), CGI::escape(String(v))
end
ensure
f.close unless f.nil?
end
end end
# Update and close the session's FileStore file. # Update and close the session's FileStore file.
def close def close
return if @f.closed?
update update
@f.close
end end
# Close and delete the session's FileStore file. # Close and delete the session's FileStore file.
def delete def delete
path = @f.path File::unlink @path
@f.close
File::unlink path
end end
end end

View file

@ -603,7 +603,7 @@ def check_sizeof(type, header = nil, &b)
end end
message(a = size ? "#{size}\n" : "failed\n") message(a = size ? "#{size}\n" : "failed\n")
Logging::message "-------------------- %s\n", a Logging::message "-------------------- %s\n", a
r size
end end
def find_executable0(bin, path = nil) def find_executable0(bin, path = nil)

View file

@ -834,9 +834,7 @@ flo_eq(x, y)
return num_equal(x, y); return num_equal(x, y);
} }
a = RFLOAT(x)->value; a = RFLOAT(x)->value;
#if defined __BORLANDC__
if (isnan(a) || isnan(b)) return Qfalse; if (isnan(a) || isnan(b)) return Qfalse;
#endif
return (a == b)?Qtrue:Qfalse; return (a == b)?Qtrue:Qfalse;
} }