diff options
author | Chris Lattner <sabre@nondot.org> | 2009-08-23 22:57:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-08-23 22:57:38 +0000 |
commit | 30ebdc431162d5ed86cad17d503eb466ddc7003e (patch) | |
tree | c82963340b8686d98561151e000699d03d65c524 /llvm/lib/System/Unix/Path.inc | |
parent | 486fcad4a8d01cb96d629244f46eb2fb4d0e47ce (diff) | |
download | bcm5719-llvm-30ebdc431162d5ed86cad17d503eb466ddc7003e.tar.gz bcm5719-llvm-30ebdc431162d5ed86cad17d503eb466ddc7003e.zip |
remove the last uses of Config/alloca.h
llvm-svn: 79873
Diffstat (limited to 'llvm/lib/System/Unix/Path.inc')
-rw-r--r-- | llvm/lib/System/Unix/Path.inc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc index 7139f4eb9bb..d7aa7115cad 100644 --- a/llvm/lib/System/Unix/Path.inc +++ b/llvm/lib/System/Unix/Path.inc @@ -16,7 +16,7 @@ //=== is guaranteed to work on *all* UNIX variants. //===----------------------------------------------------------------------===// -#include "llvm/Config/alloca.h" +#include "llvm/ADT/SmallVector.h" #include "Unix.h" #if HAVE_SYS_STAT_H #include <sys/stat.h> @@ -400,7 +400,9 @@ Path::getSuffix() const { bool Path::getMagicNumber(std::string& Magic, unsigned len) const { assert(len < 1024 && "Request for magic string too long"); - char* buf = (char*) alloca(1 + len); + SmallVector<char, 128> Buf; + Buf.resize(1 + len); + char* buf = Buf.data(); int fd = ::open(path.c_str(), O_RDONLY); if (fd < 0) return false; @@ -829,7 +831,9 @@ Path::makeUnique(bool reuse_current, std::string* ErrMsg) { // Append an XXXXXX pattern to the end of the file for use with mkstemp, // mktemp or our own implementation. - char *FNBuffer = (char*) alloca(path.size()+8); + SmallVector<char, 128> Buf; + Buf.resize(path.size()+8); + char *FNBuffer = Buf.data(); path.copy(FNBuffer,path.size()); if (isDirectory()) strcpy(FNBuffer+path.size(), "/XXXXXX"); |