diff options
author | Chris Lattner <sabre@nondot.org> | 2006-07-18 06:52:52 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-07-18 06:52:52 +0000 |
commit | c22c7d3cdf62168b8871d52d0eba3cae98f878b3 (patch) | |
tree | 2426116bc8ce07e955184f299fb9b5ebdbdc2d78 /lib/System/Unix/MappedFile.inc | |
parent | 0683c8cad920d241d44b126972d5cdd164dcc213 (diff) | |
download | external_llvm-c22c7d3cdf62168b8871d52d0eba3cae98f878b3.zip external_llvm-c22c7d3cdf62168b8871d52d0eba3cae98f878b3.tar.gz external_llvm-c22c7d3cdf62168b8871d52d0eba3cae98f878b3.tar.bz2 |
Unindent some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29169 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Unix/MappedFile.inc')
-rw-r--r-- | lib/System/Unix/MappedFile.inc | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/lib/System/Unix/MappedFile.inc b/lib/System/Unix/MappedFile.inc index 508d423..d194908 100644 --- a/lib/System/Unix/MappedFile.inc +++ b/lib/System/Unix/MappedFile.inc @@ -40,32 +40,31 @@ struct sys::MappedFileInfo { }; void MappedFile::initialize() { - if (path_.exists()) { - info_ = new MappedFileInfo; - int mode = 0; - if (options_&READ_ACCESS) - if (options_&WRITE_ACCESS) - mode = O_RDWR; - else - mode = O_RDONLY; - else if (options_&WRITE_ACCESS) - mode = O_WRONLY; - info_->fd_ = ::open(path_.c_str(),mode); - - if (info_->fd_ < 0) { - delete info_; - info_ = 0; - ThrowErrno(std::string("Can't open file: ") + path_.toString()); - } - struct stat sbuf; - if(::fstat(info_->fd_, &info_->sbuf_) < 0) { - ::close(info_->fd_); - delete info_; - info_ = 0; - ThrowErrno(std::string("Can't stat file: ") + path_.toString()); - } - } else { + if (!path_.exists()) throw std::string("Can't open file: ") + path_.toString(); + + info_ = new MappedFileInfo; + int mode = 0; + if (options_&READ_ACCESS) + if (options_&WRITE_ACCESS) + mode = O_RDWR; + else + mode = O_RDONLY; + else if (options_&WRITE_ACCESS) + mode = O_WRONLY; + info_->fd_ = ::open(path_.c_str(),mode); + + if (info_->fd_ < 0) { + delete info_; + info_ = 0; + ThrowErrno(std::string("Can't open file: ") + path_.toString()); + } + struct stat sbuf; + if(::fstat(info_->fd_, &info_->sbuf_) < 0) { + ::close(info_->fd_); + delete info_; + info_ = 0; + ThrowErrno(std::string("Can't stat file: ") + path_.toString()); } } |