summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-25 08:11:07 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-25 08:11:07 +0000
commit1b21d03d76640db4c7c96709b78d973950385b1a (patch)
treee490741cbcd0d53a8bf93ceb78b1907fa922bdbc
parentf7f7f93a03f013fb957a0e3e99237f16b5bc1fef (diff)
merge revision(s) 34809:
* lib/fileutils.rb: use chomp(?/) instead of sub to optimize and avoid to regexping invalid string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/fileutils.rb8
-rw-r--r--version.h2
3 files changed, 10 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 22ef6e71b8..0764ef42af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Feb 25 17:10:51 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * 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@ruby-lang.org>
* dir.c (dir_inspect), io.c (rb_io_inspect): keep encoding of path.
diff --git a/lib/fileutils.rb b/lib/fileutils.rb
index 29cb2354c1..ee396e35cb 100644
--- a/lib/fileutils.rb
+++ b/lib/fileutils.rb
@@ -202,7 +202,7 @@ module FileUtils
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 @@ module FileUtils
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 @@ module FileUtils
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 @@ module FileUtils
def remove_dir1
platform_support {
- Dir.rmdir path().sub(%r</\z>, '')
+ Dir.rmdir path().chomp(?/)
}
end
diff --git a/version.h b/version.h
index aafdb5b277..6a21e5ecdc 100644
--- a/version.h
+++ b/version.h
@@ -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