Cache options hash lookup on the stack
This commit is contained in:
		
							parent
							
								
									ca3c727267
								
							
						
					
					
						commit
						f743351c60
					
				@ -72,11 +72,13 @@ class Keg
 | 
			
		||||
  # lib/, and ignores binaries and other mach-o objects
 | 
			
		||||
  # Note that this doesn't attempt to distinguish between libstdc++ versions,
 | 
			
		||||
  # 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
 | 
			
		||||
 | 
			
		||||
    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
 | 
			
		||||
      results << :libcxx unless dylibs.grep(/libc\+\+.+\.dylib/).empty?
 | 
			
		||||
      results << :libstdcxx unless dylibs.grep(/libstdc\+\+.+\.dylib/).empty?
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user