diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-05 01:37:46 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-05 01:37:46 +0000 |
| commit | 7a3408c49975735e614265d7810a5bd91c699c64 (patch) | |
| tree | f5467a0440e49ed7016e2d21f44ff00de5804855 /lib | |
| parent | c0c0723bf8c3b76950a96e94e062e16c4fbecce9 (diff) | |
| download | ruby-7a3408c49975735e614265d7810a5bd91c699c64.tar.gz ruby-7a3408c49975735e614265d7810a5bd91c699c64.tar.xz ruby-7a3408c49975735e614265d7810a5bd91c699c64.zip | |
* io.c (rb_fopen): mode string copy at the lowest level.
* io.c (rb_io_flags_mode): requires output buffer no more. no
allocation needed.
* array.c (rb_ary_index): takes a block to compare items in an
array. [ruby-talk:113069] [Ruby2]
* array.c (rb_ary_rindex): ditto.
* marshal.c (r_byte): retrieve pointer from string value for each
time. [ruby-dev:24404]
* marshal.c (r_bytes0): ditto.
* enum.c (sort_by_i): re-entrance check added. [ruby-dev:24399]
* io.c (io_read): should freeze all reading buffer.
[ruby-dev:24400]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mathn.rb | 3 | ||||
| -rw-r--r-- | lib/pstore.rb | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/mathn.rb b/lib/mathn.rb index 2257a4074..aa2da885f 100644 --- a/lib/mathn.rb +++ b/lib/mathn.rb @@ -16,6 +16,7 @@ require "matrix.rb" class Integer + remove_method(:gcd2) def gcd2(int) a = self.abs b = int.abs @@ -116,6 +117,7 @@ end class Rational Unify = true + remove_method(:inspect) def inspect format "%s/%s", numerator.inspect, denominator.inspect end @@ -228,6 +230,7 @@ class Rational end module Math + remove_method(:sqrt) def sqrt(a) if a.kind_of?(Complex) abs = sqrt(a.real*a.real + a.image*a.image) diff --git a/lib/pstore.rb b/lib/pstore.rb index c4c6dd56a..dc4d976a4 100644 --- a/lib/pstore.rb +++ b/lib/pstore.rb @@ -99,11 +99,13 @@ class PStore content = nil unless read_only file = File.open(@filename, File::RDWR | File::CREAT) + file.binmode file.flock(File::LOCK_EX) commit_new(file) if FileTest.exist?(new_file) content = file.read() else file = File.open(@filename, File::RDONLY) + file.binmode file.flock(File::LOCK_SH) content = (File.read(new_file) rescue file.read()) end |
