summaryrefslogtreecommitdiffstats
path: root/llvm/utils/fpcmp/fpcmp.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-05-28 00:31:36 +0000
committerChris Lattner <sabre@nondot.org>2004-05-28 00:31:36 +0000
commit06e381d31e749b961ebc30161c9e0c73ee2cdfd3 (patch)
tree7e241b83b889a345ddf5b2ef6285fa7d1cd02194 /llvm/utils/fpcmp/fpcmp.cpp
parent90634616035a9ebcf2f5b1eb57ce2c7b98a0a227 (diff)
downloadbcm5719-llvm-06e381d31e749b961ebc30161c9e0c73ee2cdfd3.tar.gz
bcm5719-llvm-06e381d31e749b961ebc30161c9e0c73ee2cdfd3.zip
Use fileutilities instead of mmap directly
llvm-svn: 13865
Diffstat (limited to 'llvm/utils/fpcmp/fpcmp.cpp')
-rw-r--r--llvm/utils/fpcmp/fpcmp.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/llvm/utils/fpcmp/fpcmp.cpp b/llvm/utils/fpcmp/fpcmp.cpp
index 7e472d474f6..e7e318efd3d 100644
--- a/llvm/utils/fpcmp/fpcmp.cpp
+++ b/llvm/utils/fpcmp/fpcmp.cpp
@@ -37,25 +37,11 @@ namespace {
/// OpenFile - mmap the specified file into the address space for reading, and
/// return the length and address of the buffer.
static void OpenFile(const std::string &Filename, unsigned &Len, char* &BufPtr){
- int FD = open(Filename.c_str(), O_RDONLY);
- if (FD == -1 || (Len = getFileSize(Filename)) == ~0U) {
+ BufPtr = (char*)ReadFileIntoAddressSpace(Filename, Len);
+ if (BufPtr == 0) {
std::cerr << "Error: cannot open file '" << Filename << "'\n";
exit(2);
}
-
- // mmap in the file all at once...
- BufPtr = (char*)mmap(0, Len, PROT_READ, MAP_PRIVATE, FD, 0);
-
- if (BufPtr == (char*)MAP_FAILED) {
- std::cerr << "Error: cannot open file '" << Filename << "'\n";
- exit(2);
- }
-
- // If mmap decided that the files were empty, it might have returned a
- // null pointer. If so, make a new, fake pointer -- it shouldn't matter
- // what it contains, because Len is 0, and it should never be read.
- if (BufPtr == 0 && Len == 0)
- BufPtr = new char[1];
}
static bool isNumberChar(char C) {
OpenPOWER on IntegriCloud