diff options
author | Chris Lattner <sabre@nondot.org> | 2007-05-06 05:32:21 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-05-06 05:32:21 +0000 |
commit | f283a5e53a99d13035a9e783acff80d4ea064a92 (patch) | |
tree | 427ceda31a38aa6c237ac5a53a6601325b22cad7 /lib/System/Unix/Path.inc | |
parent | 609083b9e035b1545cf75111c576fc32aa536d6d (diff) | |
download | llvm-f283a5e53a99d13035a9e783acff80d4ea064a92.tar.gz llvm-f283a5e53a99d13035a9e783acff80d4ea064a92.tar.bz2 llvm-f283a5e53a99d13035a9e783acff80d4ea064a92.tar.xz |
pull some win32 code into common code, add bitcode identification support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36846 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Unix/Path.inc')
-rw-r--r-- | lib/System/Unix/Path.inc | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc index 53906d99ce..db95e3c216 100644 --- a/lib/System/Unix/Path.inc +++ b/lib/System/Unix/Path.inc @@ -267,21 +267,6 @@ Path::getBasename() const { return path.substr(slash, dot - slash); } -bool Path::hasMagicNumber(const std::string &Magic) const { - size_t len = Magic.size(); - assert(len < 1024 && "Request for magic string too long"); - char* buf = (char*) alloca(1 + len); - int fd = ::open(path.c_str(), O_RDONLY); - if (fd < 0) - return false; - size_t read_len = ::read(fd, buf, len); - close(fd); - if (len != read_len) - return false; - buf[len] = '\0'; - return Magic == buf; -} - bool Path::getMagicNumber(std::string& Magic, unsigned len) const { assert(len < 1024 && "Request for magic string too long"); char* buf = (char*) alloca(1 + len); @@ -298,22 +283,6 @@ bool Path::getMagicNumber(std::string& Magic, unsigned len) const { return true; } -bool -Path::isBytecodeFile() const { - char buffer[4]; - buffer[0] = 0; - int fd = ::open(path.c_str(), O_RDONLY); - if (fd < 0) - return false; - ssize_t bytes_read = ::read(fd, buffer, 4); - ::close(fd); - if (4 != bytes_read) - return false; - - return (buffer[0] == 'l' && buffer[1] == 'l' && buffer[2] == 'v' && - (buffer[3] == 'c' || buffer[3] == 'm')); -} - bool Path::exists() const { return 0 == access(path.c_str(), F_OK ); |