Cache options hash lookup on the stack

This commit is contained in:
Jack Nagel 2014-08-09 17:37:57 -05:00
parent ca3c727267
commit f743351c60

View File

@ -72,11 +72,13 @@ class Keg
# lib/, and ignores binaries and other mach-o objects # lib/, and ignores binaries and other mach-o objects
# Note that this doesn't attempt to distinguish between libstdc++ versions, # Note that this doesn't attempt to distinguish between libstdc++ versions,
# for instance between Apple libstdc++ and GNU libstdc++ # for instance between Apple libstdc++ and GNU libstdc++
def detect_cxx_stdlibs(opts={:skip_executables => false}) def detect_cxx_stdlibs(options={})
options = { :skip_executables => false }.merge(options)
skip_executables = options[:skip_executables]
results = Set.new results = Set.new
mach_o_files.each do |file| mach_o_files.each do |file|
next if file.mach_o_executable? && opts[:skip_executables] next if file.mach_o_executable? && skip_executables
dylibs = file.dynamically_linked_libraries dylibs = file.dynamically_linked_libraries
results << :libcxx unless dylibs.grep(/libc\+\+.+\.dylib/).empty? results << :libcxx unless dylibs.grep(/libc\+\+.+\.dylib/).empty?
results << :libstdcxx unless dylibs.grep(/libstdc\+\+.+\.dylib/).empty? results << :libstdcxx unless dylibs.grep(/libstdc\+\+.+\.dylib/).empty?