ruby-changes:22762
From: naruse <ko1@a...>
Date: Sat, 25 Feb 2012 17:11:17 +0900 (JST)
Subject: [ruby-changes:22762] naruse:r34811 (ruby_1_9_3): merge revision(s) 34809:
naruse 2012-02-25 17:11:07 +0900 (Sat, 25 Feb 2012) New Revision: 34811 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34811 Log: merge revision(s) 34809: * lib/fileutils.rb: use chomp(?/) instead of sub to optimize and avoid to regexping invalid string. Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/lib/fileutils.rb branches/ruby_1_9_3/version.h Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 34810) +++ ruby_1_9_3/ChangeLog (revision 34811) @@ -1,3 +1,8 @@ +Sat Feb 25 17:10:51 2012 NARUSE, Yui <naruse@r...> + + * lib/fileutils.rb: use chomp(?/) instead of sub to optimize and avoid + to regexping invalid string. + Sat Feb 25 17:09:53 2012 Nobuyoshi Nakada <nobu@r...> * dir.c (dir_inspect), io.c (rb_io_inspect): keep encoding of path. Index: ruby_1_9_3/lib/fileutils.rb =================================================================== --- ruby_1_9_3/lib/fileutils.rb (revision 34810) +++ ruby_1_9_3/lib/fileutils.rb (revision 34811) @@ -202,7 +202,7 @@ fu_output_message "mkdir -p #{options[:mode] ? ('-m %03o ' % options[:mode]) : ''}#{list.join ' '}" if options[:verbose] return *list if options[:noop] - list.map {|path| path.sub(%r</\z>, '') }.each do |path| + list.map {|path| path.chomp(?/) }.each do |path| # optimize for the most common case begin fu_mkdir path, options[:mode] @@ -239,7 +239,7 @@ OPT_TABLE['makedirs'] = [:mode, :noop, :verbose] def fu_mkdir(path, mode) #:nodoc: - path = path.sub(%r</\z>, '') + path = path.chomp(?/) if mode Dir.mkdir path, mode File.chmod mode, path @@ -267,7 +267,7 @@ return if options[:noop] list.each do |dir| begin - Dir.rmdir(dir = dir.sub(%r</\z>, '')) + Dir.rmdir(dir = dir.chomp(?/)) if parents until (parent = File.dirname(dir)) == '.' or parent == dir Dir.rmdir(dir) @@ -1397,7 +1397,7 @@ def remove_dir1 platform_support { - Dir.rmdir path().sub(%r</\z>, '') + Dir.rmdir path().chomp(?/) } end Index: ruby_1_9_3/version.h =================================================================== --- ruby_1_9_3/version.h (revision 34810) +++ ruby_1_9_3/version.h (revision 34811) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 145 +#define RUBY_PATCHLEVEL 146 #define RUBY_RELEASE_DATE "2012-02-25" #define RUBY_RELEASE_YEAR 2012 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/