* lib/matrix.rb: remove elements conversion to_f, to_i, to_r.
* lib/cgi/session/pstore.rb: add new file. * process.c (proc_getgroups, proc_setmaxgroups): fix typo. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bdfce148a7
commit
9ef8a2a5db
14
ChangeLog
14
ChangeLog
@ -1,7 +1,17 @@
|
|||||||
|
Tue Jul 15 14:38:21 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/matrix.rb: remove elements conversion to_f, to_i, to_r.
|
||||||
|
|
||||||
|
* lib/cgi/session/pstore.rb: add new file.
|
||||||
|
|
||||||
Tue Jul 15 03:30:41 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
|
Tue Jul 15 03:30:41 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
|
||||||
|
|
||||||
* ext/syck/rubyext.c (syck_mark_emitter): forgot to rb_gc_mark the
|
* ext/syck/rubyext.c (syck_mark_emitter): forgot to rb_gc_mark the
|
||||||
outgoing IO object.
|
outgoing IO object.
|
||||||
|
|
||||||
|
Sun Jul 13 14:55:36 2003 Koji Arai <jca02266@nifty.ne.jp>
|
||||||
|
|
||||||
|
* process.c (proc_getgroups, proc_setmaxgroups): fix typo.
|
||||||
|
|
||||||
Sat Jul 12 17:01:28 2003 NAKAMURA Usaku <usa@ruby-lang.org>
|
Sat Jul 12 17:01:28 2003 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
5
hash.c
5
hash.c
@ -1019,10 +1019,11 @@ env_delete(obj, name)
|
|||||||
|
|
||||||
ruby_setenv(nam, 0);
|
ruby_setenv(nam, 0);
|
||||||
#ifdef ENV_IGNORECASE
|
#ifdef ENV_IGNORECASE
|
||||||
if (strcasecmp(nam, PATH_ENV) == 0) {
|
if (strcasecmp(nam, PATH_ENV) == 0)
|
||||||
#else
|
#else
|
||||||
if (strcmp(nam, PATH_ENV) == 0) {
|
if (strcmp(nam, PATH_ENV) == 0)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
path_tainted = 0;
|
path_tainted = 0;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
1
intern.h
1
intern.h
@ -289,6 +289,7 @@ VALUE rb_obj_is_kind_of _((VALUE, VALUE));
|
|||||||
VALUE rb_obj_alloc _((VALUE));
|
VALUE rb_obj_alloc _((VALUE));
|
||||||
VALUE rb_obj_clone _((VALUE));
|
VALUE rb_obj_clone _((VALUE));
|
||||||
VALUE rb_obj_dup _((VALUE));
|
VALUE rb_obj_dup _((VALUE));
|
||||||
|
VALUE rb_obj_init_copy _((VALUE,VALUE));
|
||||||
VALUE rb_obj_taint _((VALUE));
|
VALUE rb_obj_taint _((VALUE));
|
||||||
VALUE rb_obj_tainted _((VALUE));
|
VALUE rb_obj_tainted _((VALUE));
|
||||||
VALUE rb_obj_untaint _((VALUE));
|
VALUE rb_obj_untaint _((VALUE));
|
||||||
|
78
lib/cgi/session/pstore.rb
Normal file
78
lib/cgi/session/pstore.rb
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
require 'cgi/session'
|
||||||
|
require 'pstore'
|
||||||
|
|
||||||
|
class CGI
|
||||||
|
class Session
|
||||||
|
def []=(key, val)
|
||||||
|
unless @write_lock
|
||||||
|
@write_lock = true
|
||||||
|
end
|
||||||
|
unless @data
|
||||||
|
@data = @dbman.restore
|
||||||
|
end
|
||||||
|
#@data[key] = String(val)
|
||||||
|
@data[key] = val
|
||||||
|
end
|
||||||
|
|
||||||
|
class PStore
|
||||||
|
def check_id(id)
|
||||||
|
/[^0-9a-zA-Z]/ =~ id.to_s ? false : true
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize session, option={}
|
||||||
|
dir = option['tmpdir'] || ENV['TMP'] || '/tmp'
|
||||||
|
prefix = option['prefix'] || ''
|
||||||
|
id = session.session_id
|
||||||
|
unless check_id(id)
|
||||||
|
raise ArgumentError, "session_id `%s' is invalid" % id
|
||||||
|
end
|
||||||
|
path = dir+"/"+prefix+id
|
||||||
|
path.untaint
|
||||||
|
unless File::exist? path
|
||||||
|
@hash = {}
|
||||||
|
end
|
||||||
|
@p = ::PStore.new path
|
||||||
|
end
|
||||||
|
|
||||||
|
def restore
|
||||||
|
unless @hash
|
||||||
|
@p.transaction do
|
||||||
|
begin
|
||||||
|
@hash = @p['hash']
|
||||||
|
rescue
|
||||||
|
@hash = {}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@hash
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@p.transaction do
|
||||||
|
@p['hash'] = @hash
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def close
|
||||||
|
update
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete
|
||||||
|
path = @p.path
|
||||||
|
File::unlink path
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if $0 == __FILE__
|
||||||
|
STDIN.reopen("/dev/null")
|
||||||
|
cgi = CGI.new
|
||||||
|
session = CGI::Session.new cgi, 'database_manager' => CGI::Session::PStore
|
||||||
|
session['key'] = {'k' => 'v'}
|
||||||
|
puts session['key'].class
|
||||||
|
fail unless Hash === session['key']
|
||||||
|
puts session['key'].inspect
|
||||||
|
fail unless session['key'].inspect == '{"k"=>"v"}'
|
||||||
|
end
|
@ -126,13 +126,7 @@
|
|||||||
# column_vectors
|
# column_vectors
|
||||||
# array of column vectors
|
# array of column vectors
|
||||||
# to_a
|
# to_a
|
||||||
# converts each element to Array
|
# converts to Array of Arrays
|
||||||
# to_f
|
|
||||||
# converts each element to Float
|
|
||||||
# to_i
|
|
||||||
# converts each element to Integer
|
|
||||||
# to_r
|
|
||||||
# converts each element to Rational
|
|
||||||
# PRINTING:
|
# PRINTING:
|
||||||
# to_s
|
# to_s
|
||||||
# returns string representation
|
# returns string representation
|
||||||
@ -163,9 +157,6 @@
|
|||||||
# CONVERTING:
|
# CONVERTING:
|
||||||
# covector
|
# covector
|
||||||
# to_a
|
# to_a
|
||||||
# to_f
|
|
||||||
# to_i
|
|
||||||
# to_r
|
|
||||||
# coerce(other)
|
# coerce(other)
|
||||||
# PRINTING:
|
# PRINTING:
|
||||||
# to_s
|
# to_s
|
||||||
@ -936,27 +927,6 @@ class Matrix
|
|||||||
@rows.collect{|row| row.collect{|e| e}}
|
@rows.collect{|row| row.collect{|e| e}}
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
|
||||||
# Applies #to_f to all elements to return a new matrix.
|
|
||||||
#
|
|
||||||
def to_f
|
|
||||||
collect{|e| e.to_f}
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
|
||||||
# Applies #to_i to all elements to return a new matrix.
|
|
||||||
#
|
|
||||||
def to_i
|
|
||||||
collect{|e| e.to_i}
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
|
||||||
# Applies #to_r to all elements to return a new matrix.
|
|
||||||
#
|
|
||||||
def to_r
|
|
||||||
collect{|e| e.to_r}
|
|
||||||
end
|
|
||||||
|
|
||||||
#--
|
#--
|
||||||
# PRINTING -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
# PRINTING -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||||
#++
|
#++
|
||||||
@ -1314,27 +1284,6 @@ class Vector
|
|||||||
@elements.dup
|
@elements.dup
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
|
||||||
# Applies #to_f to each element to produce a new vector.
|
|
||||||
#
|
|
||||||
def to_f
|
|
||||||
collect{|e| e.to_f}
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
|
||||||
# Applies #to_i to each element to produce a new vector.
|
|
||||||
#
|
|
||||||
def to_i
|
|
||||||
collect{|e| e.to_i}
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
|
||||||
# Applies #to_f to each element to produce a new vector.
|
|
||||||
#
|
|
||||||
def to_r
|
|
||||||
collect{|e| e.to_r}
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# FIXME: describe Vector#coerce.
|
# FIXME: describe Vector#coerce.
|
||||||
#
|
#
|
||||||
|
@ -1231,13 +1231,13 @@ proc_getgroups(VALUE obj)
|
|||||||
{
|
{
|
||||||
#ifdef HAVE_GETGROUPS
|
#ifdef HAVE_GETGROUPS
|
||||||
VALUE ary;
|
VALUE ary;
|
||||||
size_t ngroups = 32;
|
size_t ngroups;
|
||||||
gid_t *groups;
|
gid_t *groups;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
groups = ALLOCA_N(gid_t, maxgroups);
|
groups = ALLOCA_N(gid_t, maxgroups);
|
||||||
|
|
||||||
ngroups = getgroups(ngroups, groups);
|
ngroups = getgroups(maxgroups, groups);
|
||||||
if (ngroups == -1)
|
if (ngroups == -1)
|
||||||
rb_sys_fail(0);
|
rb_sys_fail(0);
|
||||||
|
|
||||||
@ -1312,7 +1312,7 @@ static VALUE
|
|||||||
proc_setmaxgroups(obj, val)
|
proc_setmaxgroups(obj, val)
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
{
|
{
|
||||||
size_t ngroups = INT2FIX(val);
|
size_t ngroups = FIX2INT(val);
|
||||||
|
|
||||||
if (ngroups > 4096)
|
if (ngroups > 4096)
|
||||||
ngroups = 4096;
|
ngroups = 4096;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user