[llvm-commits] CVS: llvm/lib/System/Unix/MappedFile.inc
Reid Spencer
reid at x10sys.com
Thu Mar 29 12:11:39 PDT 2007
Changes in directory llvm/lib/System/Unix:
MappedFile.inc updated: 1.18 -> 1.19
---
Log message:
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.
---
Diffs of the changes: (+3 -4)
MappedFile.inc | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
Index: llvm/lib/System/Unix/MappedFile.inc
diff -u llvm/lib/System/Unix/MappedFile.inc:1.18 llvm/lib/System/Unix/MappedFile.inc:1.19
--- llvm/lib/System/Unix/MappedFile.inc:1.18 Fri Aug 25 16:37:17 2006
+++ llvm/lib/System/Unix/MappedFile.inc Thu Mar 29 14:11:22 2007
@@ -54,15 +54,14 @@
MakeErrMsg(ErrMsg, "can't open file '" + path_.toString() + "'");
return true;
}
- struct stat sbuf;
- if(::fstat(FD, &sbuf) < 0) {
- MakeErrMsg(ErrMsg, "can't stat file '"+ path_.toString() + "'");
+ const FileStatus *Status = path_.getFileStatus(false, ErrMsg);
+ if (!Status) {
::close(FD);
return true;
}
info_ = new MappedFileInfo;
info_->FD = FD;
- info_->Size = sbuf.st_size;
+ info_->Size = Status->getSize();
return false;
}
More information about the llvm-commits
mailing list