mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@6996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
889a620b76
commit
c800d0b75d
7 changed files with 133 additions and 87 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue