mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* dir.c (dir_open_dir): new function. [ruby-dev:25242]
* hash.c (Init_Hash): remove custom "hash" and "eql?". * lib/set.rb (Set::eql): wrong definition. [ruby-dev:25207] * object.c (rb_obj_id_obsolete): warn always. * eval.c (rb_enable_super): ditto. * lib/set.rb (Set#==): [ruby-dev:25206] * lib/pstore.rb (PStore#transaction): Use the empty content when a file is not found. [ruby-dev:24561] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7836e8ade3
commit
125514995c
7 changed files with 57 additions and 71 deletions
27
ChangeLog
27
ChangeLog
|
|
@ -1,3 +1,7 @@
|
||||||
|
Sat Dec 18 10:51:01 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* dir.c (dir_open_dir): new function. [ruby-dev:25242]
|
||||||
|
|
||||||
Fri Dec 17 18:07:01 2004 Shugo Maeda <shugo@ruby-lang.org>
|
Fri Dec 17 18:07:01 2004 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
* test/readline/test_readline.rb: fix for BSD. Thanks, GOTOU Yuuzou.
|
* test/readline/test_readline.rb: fix for BSD. Thanks, GOTOU Yuuzou.
|
||||||
|
|
@ -122,6 +126,14 @@ Thu Dec 16 03:14:28 2004 Minero Aoki <aamine@loveruby.net>
|
||||||
include multiple CR/LFs. Backported from main trunk (rev 1.112).
|
include multiple CR/LFs. Backported from main trunk (rev 1.112).
|
||||||
[ruby-dev:25212]
|
[ruby-dev:25212]
|
||||||
|
|
||||||
|
Thu Dec 16 00:33:37 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* hash.c (Init_Hash): remove custom "hash" and "eql?".
|
||||||
|
|
||||||
|
Wed Dec 15 18:57:01 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/set.rb (Set::eql): wrong definition. [ruby-dev:25207]
|
||||||
|
|
||||||
Wed Dec 15 18:48:42 2004 Shugo Maeda <shugo@ruby-lang.org>
|
Wed Dec 15 18:48:42 2004 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
* ext/curses/curses.c (window_subwin): call NUM2INT() before
|
* ext/curses/curses.c (window_subwin): call NUM2INT() before
|
||||||
|
|
@ -137,6 +149,16 @@ Wed Dec 15 15:39:32 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||||
* ext/openssl/ossl_x509name.c (ossl_x509name_to_a): avoid SEGV
|
* ext/openssl/ossl_x509name.c (ossl_x509name_to_a): avoid SEGV
|
||||||
(rollback the previous commit).
|
(rollback the previous commit).
|
||||||
|
|
||||||
|
Wed Dec 15 16:10:23 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* object.c (rb_obj_id_obsolete): warn always.
|
||||||
|
|
||||||
|
* eval.c (rb_enable_super): ditto.
|
||||||
|
|
||||||
|
Wed Dec 15 15:31:02 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/set.rb (Set#==): [ruby-dev:25206]
|
||||||
|
|
||||||
Wed Dec 15 14:22:10 2004 NAKAMURA Usaku <usa@ruby-lang.org>
|
Wed Dec 15 14:22:10 2004 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* win32/win32.c (rb_w32_fdisset): check whether the handle is valid.
|
* win32/win32.c (rb_w32_fdisset): check whether the handle is valid.
|
||||||
|
|
@ -1252,6 +1274,11 @@ Fri Oct 22 00:20:33 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
* string.c (rb_str_include): should not treat char as negative value.
|
* string.c (rb_str_include): should not treat char as negative value.
|
||||||
[ruby-dev:24558]
|
[ruby-dev:24558]
|
||||||
|
|
||||||
|
Thu Oct 21 21:32:30 2004 IWATSUKI Hiroyuki <don@na.rim.or.jp>
|
||||||
|
|
||||||
|
* lib/pstore.rb (PStore#transaction): Use the empty content when a
|
||||||
|
file is not found. [ruby-dev:24561]
|
||||||
|
|
||||||
Thu Oct 21 19:06:15 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
Thu Oct 21 19:06:15 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||||
|
|
||||||
* lib/webrick/httpresponse.rb (WEBrick::HTTPResponse#send_body_io):
|
* lib/webrick/httpresponse.rb (WEBrick::HTTPResponse#send_body_io):
|
||||||
|
|
|
||||||
20
dir.c
20
dir.c
|
|
@ -1318,6 +1318,22 @@ dir_s_glob(argc, argv, obj)
|
||||||
return rb_push_glob(str, flags);
|
return rb_push_glob(str, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
dir_open_dir(path)
|
||||||
|
VALUE path;
|
||||||
|
{
|
||||||
|
struct dir_data *dp;
|
||||||
|
VALUE dir = rb_funcall(rb_cDir, rb_intern("open"), 1, path);
|
||||||
|
|
||||||
|
if (TYPE(dir) != T_DATA ||
|
||||||
|
RDATA(dir)->dfree != (RUBY_DATA_FUNC)free_dir) {
|
||||||
|
rb_raise(rb_eTypeError, "wrong argument type %s (expected Dir)",
|
||||||
|
rb_obj_classname(dir));
|
||||||
|
}
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* Dir.foreach( dirname ) {| filename | block } => nil
|
* Dir.foreach( dirname ) {| filename | block } => nil
|
||||||
|
|
@ -1341,7 +1357,7 @@ dir_foreach(io, dirname)
|
||||||
{
|
{
|
||||||
VALUE dir;
|
VALUE dir;
|
||||||
|
|
||||||
dir = rb_funcall(rb_cDir, rb_intern("open"), 1, dirname);
|
dir = dir_open_dir(dirname);
|
||||||
rb_ensure(dir_each, dir, dir_close, dir);
|
rb_ensure(dir_each, dir, dir_close, dir);
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
@ -1363,7 +1379,7 @@ dir_entries(io, dirname)
|
||||||
{
|
{
|
||||||
VALUE dir;
|
VALUE dir;
|
||||||
|
|
||||||
dir = rb_funcall(rb_cDir, rb_intern("open"), 1, dirname);
|
dir = dir_open_dir(dirname);
|
||||||
return rb_ensure(rb_Array, dir, dir_close, dir);
|
return rb_ensure(rb_Array, dir, dir_close, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
2
eval.c
2
eval.c
|
|
@ -538,7 +538,7 @@ rb_enable_super(klass, name)
|
||||||
VALUE klass;
|
VALUE klass;
|
||||||
const char *name;
|
const char *name;
|
||||||
{
|
{
|
||||||
rb_warning("rb_enable_super() is obsolete");
|
rb_warn("rb_enable_super() is obsolete");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
2
file.c
2
file.c
|
|
@ -2901,7 +2901,7 @@ rb_file_truncate(obj, len)
|
||||||
# define LOCK_UN 8
|
# define LOCK_UN 8
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
static int
|
static int
|
||||||
rb_thread_flock(fd, op, fptr)
|
rb_thread_flock(fd, op, fptr)
|
||||||
int fd, op;
|
int fd, op;
|
||||||
|
|
|
||||||
61
hash.c
61
hash.c
|
|
@ -1503,65 +1503,6 @@ rb_hash_equal(hash1, hash2)
|
||||||
return hash_equal(hash1, hash2, Qfalse);
|
return hash_equal(hash1, hash2, Qfalse);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* call-seq:
|
|
||||||
* hsh.eql?(other_hash) => true or false
|
|
||||||
*
|
|
||||||
* Returns true if two hashes are equal, i.e they have same key-value set,
|
|
||||||
* and same default values.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
static VALUE
|
|
||||||
rb_hash_eql(hash1, hash2)
|
|
||||||
VALUE hash1, hash2;
|
|
||||||
{
|
|
||||||
return hash_equal(hash1, hash2, Qtrue);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
rb_hash_hash_i(key, value, hp)
|
|
||||||
VALUE key, value;
|
|
||||||
long *hp;
|
|
||||||
{
|
|
||||||
long h = *hp;
|
|
||||||
VALUE n;
|
|
||||||
|
|
||||||
h = (h << 1) | (h<0 ? 1 : 0);
|
|
||||||
n = rb_hash(key);
|
|
||||||
h ^= NUM2LONG(n);
|
|
||||||
h = (h << 1) | (h<0 ? 1 : 0);
|
|
||||||
n = rb_hash(value);
|
|
||||||
h ^= NUM2LONG(n);
|
|
||||||
|
|
||||||
*hp = h;
|
|
||||||
return ST_CONTINUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* call-seq:
|
|
||||||
* hash.hash -> fixnum
|
|
||||||
*
|
|
||||||
* Compute a hash-code for this hash. Two hashes with the same content
|
|
||||||
* will have the same hash code (and will compare using <code>eql?</code>).
|
|
||||||
*/
|
|
||||||
|
|
||||||
static VALUE
|
|
||||||
rb_hash_hash(hash)
|
|
||||||
VALUE hash;
|
|
||||||
{
|
|
||||||
long h;
|
|
||||||
VALUE n;
|
|
||||||
|
|
||||||
h = RHASH(hash)->tbl->num_entries;
|
|
||||||
rb_hash_foreach(hash, rb_hash_hash_i, (VALUE)&h);
|
|
||||||
h = (h << 1) | (h<0 ? 1 : 0);
|
|
||||||
n = rb_hash(RHASH(hash)->ifnone);
|
|
||||||
h ^= NUM2LONG(n);
|
|
||||||
|
|
||||||
return LONG2FIX(h);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
rb_hash_invert_i(key, value, hash)
|
rb_hash_invert_i(key, value, hash)
|
||||||
VALUE key, value;
|
VALUE key, value;
|
||||||
|
|
@ -2496,8 +2437,6 @@ Init_Hash()
|
||||||
rb_define_method(rb_cHash,"inspect", rb_hash_inspect, 0);
|
rb_define_method(rb_cHash,"inspect", rb_hash_inspect, 0);
|
||||||
|
|
||||||
rb_define_method(rb_cHash,"==", rb_hash_equal, 1);
|
rb_define_method(rb_cHash,"==", rb_hash_equal, 1);
|
||||||
rb_define_method(rb_cHash,"eql?", rb_hash_eql, 1);
|
|
||||||
rb_define_method(rb_cHash,"hash", rb_hash_hash, 0);
|
|
||||||
rb_define_method(rb_cHash,"[]", rb_hash_aref, 1);
|
rb_define_method(rb_cHash,"[]", rb_hash_aref, 1);
|
||||||
rb_define_method(rb_cHash,"fetch", rb_hash_fetch, -1);
|
rb_define_method(rb_cHash,"fetch", rb_hash_fetch, -1);
|
||||||
rb_define_method(rb_cHash,"[]=", rb_hash_aset, 2);
|
rb_define_method(rb_cHash,"[]=", rb_hash_aset, 2);
|
||||||
|
|
|
||||||
14
lib/set.rb
14
lib/set.rb
|
|
@ -251,7 +251,7 @@ class Set
|
||||||
# Merges the elements of the given enumerable object to the set and
|
# Merges the elements of the given enumerable object to the set and
|
||||||
# returns self.
|
# returns self.
|
||||||
def merge(enum)
|
def merge(enum)
|
||||||
if enum.class == self.class
|
if enum.is_a?(Set)
|
||||||
@hash.update(enum.instance_eval { @hash })
|
@hash.update(enum.instance_eval { @hash })
|
||||||
else
|
else
|
||||||
enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
|
enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
|
||||||
|
|
@ -291,7 +291,7 @@ class Set
|
||||||
def &(enum)
|
def &(enum)
|
||||||
enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
|
enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
|
||||||
n = self.class.new
|
n = self.class.new
|
||||||
enum.each { |o| include?(o) and n.add(o) }
|
enum.each { |o| n.add(o) if include?(o) }
|
||||||
n
|
n
|
||||||
end
|
end
|
||||||
alias intersection & ##
|
alias intersection & ##
|
||||||
|
|
@ -313,7 +313,8 @@ class Set
|
||||||
|
|
||||||
set.is_a?(Set) && size == set.size or return false
|
set.is_a?(Set) && size == set.size or return false
|
||||||
|
|
||||||
set.all? { |o| include?(o) }
|
hash = @hash.dup
|
||||||
|
set.all? { |o| hash.include?(o) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def hash # :nodoc:
|
def hash # :nodoc:
|
||||||
|
|
@ -321,7 +322,8 @@ class Set
|
||||||
end
|
end
|
||||||
|
|
||||||
def eql?(o) # :nodoc:
|
def eql?(o) # :nodoc:
|
||||||
@hash.hash == o.hash
|
return false unless o.is_a?(Set)
|
||||||
|
@hash.eql?(o.instance_eval{@hash})
|
||||||
end
|
end
|
||||||
|
|
||||||
# Classifies the set by the return value of the given block and
|
# Classifies the set by the return value of the given block and
|
||||||
|
|
@ -583,7 +585,9 @@ end
|
||||||
# else
|
# else
|
||||||
# instance_eval %{
|
# instance_eval %{
|
||||||
# def add(o)
|
# def add(o)
|
||||||
# @hash[o] = true if @proc.call(o)
|
# if @proc.call(o)
|
||||||
|
# @hash[o] = true
|
||||||
|
# end
|
||||||
# self
|
# self
|
||||||
# end
|
# end
|
||||||
# alias << add
|
# alias << add
|
||||||
|
|
|
||||||
2
object.c
2
object.c
|
|
@ -149,7 +149,7 @@ VALUE
|
||||||
rb_obj_id_obsolete(obj)
|
rb_obj_id_obsolete(obj)
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
{
|
{
|
||||||
rb_warning("Object#id will be deprecated; use Object#object_id");
|
rb_warn("Object#id will be deprecated; use Object#object_id");
|
||||||
return rb_obj_id(obj);
|
return rb_obj_id(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue