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 | 3eb42b7d14a06a35ea04bdb0ca69af6bbcec763b (patch) | |
tree | e7e3d9c387ed7bf4975cb60c857835722159cf17 /llvm/lib/System | |
parent | 9d4ff4407ec860da1565a5c97ff8121b7c293182 (diff) | |
download | bcm5719-llvm-3eb42b7d14a06a35ea04bdb0ca69af6bbcec763b.tar.gz bcm5719-llvm-3eb42b7d14a06a35ea04bdb0ca69af6bbcec763b.zip |
Unindent some code
llvm-svn: 29169
Diffstat (limited to 'llvm/lib/System')
-rw-r--r-- | llvm/lib/System/Unix/MappedFile.inc | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/llvm/lib/System/Unix/MappedFile.inc b/llvm/lib/System/Unix/MappedFile.inc index 508d4235c43..d194908a30e 100644 --- a/llvm/lib/System/Unix/MappedFile.inc +++ b/llvm/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()); } } |