[ruby/fileutils] Reduce global variables

https://github.com/ruby/fileutils/commit/ba81f024cf
This commit is contained in:
Kazuhiro NISHIYAMA 2019-08-24 21:19:31 +09:00 committed by Hiroshi SHIBATA
parent 06c35cfa65
commit d5355123cc
No known key found for this signature in database
GPG Key ID: F9CF13417264FAC2

View File

@ -1520,14 +1520,14 @@ module FileUtils
private private
$fileutils_rb_have_lchmod = nil @@fileutils_rb_have_lchmod = nil
def have_lchmod? def have_lchmod?
# This is not MT-safe, but it does not matter. # This is not MT-safe, but it does not matter.
if $fileutils_rb_have_lchmod == nil if @@fileutils_rb_have_lchmod == nil
$fileutils_rb_have_lchmod = check_have_lchmod? @@fileutils_rb_have_lchmod = check_have_lchmod?
end end
$fileutils_rb_have_lchmod @@fileutils_rb_have_lchmod
end end
def check_have_lchmod? def check_have_lchmod?
@ -1538,14 +1538,14 @@ module FileUtils
return false return false
end end
$fileutils_rb_have_lchown = nil @@fileutils_rb_have_lchown = nil
def have_lchown? def have_lchown?
# This is not MT-safe, but it does not matter. # This is not MT-safe, but it does not matter.
if $fileutils_rb_have_lchown == nil if @@fileutils_rb_have_lchown == nil
$fileutils_rb_have_lchown = check_have_lchown? @@fileutils_rb_have_lchown = check_have_lchown?
end end
$fileutils_rb_have_lchown @@fileutils_rb_have_lchown
end end
def check_have_lchown? def check_have_lchown?