[llvm-commits] CVS: llvm/lib/System/Unix/MappedFile.inc

Chris Lattner lattner at cs.uiuc.edu
Mon Jul 17 23:53:04 PDT 2006



Changes in directory llvm/lib/System/Unix:

MappedFile.inc updated: 1.11 -> 1.12
---
Log message:

Unindent some code


---
Diffs of the changes:  (+24 -25)

 MappedFile.inc |   49 ++++++++++++++++++++++++-------------------------
 1 files changed, 24 insertions(+), 25 deletions(-)


Index: llvm/lib/System/Unix/MappedFile.inc
diff -u llvm/lib/System/Unix/MappedFile.inc:1.11 llvm/lib/System/Unix/MappedFile.inc:1.12
--- llvm/lib/System/Unix/MappedFile.inc:1.11	Thu May  5 17:33:06 2005
+++ llvm/lib/System/Unix/MappedFile.inc	Tue Jul 18 01:52:52 2006
@@ -40,32 +40,31 @@
 };
 
 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());
   }
 }
 






More information about the llvm-commits mailing list