mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-30 16:17:05 +00:00 
			
		
		
		
	Use the stat information in the Path object, if it is already obtained. This
avoids a call to ::fstat by MappedFile when the file size information was already obtained by the Path object. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35477 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		| @@ -54,15 +54,14 @@ bool MappedFile::initialize(std::string* ErrMsg) { | |||||||
|     MakeErrMsg(ErrMsg, "can't open file '" + path_.toString() + "'"); |     MakeErrMsg(ErrMsg, "can't open file '" + path_.toString() + "'"); | ||||||
|     return true; |     return true; | ||||||
|   }  |   }  | ||||||
|   struct stat sbuf; |   const FileStatus *Status = path_.getFileStatus(false, ErrMsg); | ||||||
|   if(::fstat(FD, &sbuf) < 0) { |   if (!Status) { | ||||||
|     MakeErrMsg(ErrMsg, "can't stat file '"+ path_.toString() + "'"); |  | ||||||
|     ::close(FD); |     ::close(FD); | ||||||
|     return true; |     return true; | ||||||
|   } |   } | ||||||
|   info_ = new MappedFileInfo; |   info_ = new MappedFileInfo; | ||||||
|   info_->FD = FD; |   info_->FD = FD; | ||||||
|   info_->Size = sbuf.st_size; |   info_->Size = Status->getSize(); | ||||||
|   return false; |   return false; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user