diff options
author | Chris Lattner <sabre@nondot.org> | 2009-12-23 23:03:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-12-23 23:03:24 +0000 |
commit | 62dc896bc458ca37f212f1244be6c87007703976 (patch) | |
tree | acc1df13d0aa5e90d8d5e6cf4a4c5d1796089758 /lib/Support/MemoryBuffer.cpp | |
parent | fb64f11ced9f1d65df5bcac99b8a8b884039b582 (diff) |
sizeof(char) is always 1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92079 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/MemoryBuffer.cpp')
-rw-r--r-- | lib/Support/MemoryBuffer.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp index df1aa6a25d..9253b01d58 100644 --- a/lib/Support/MemoryBuffer.cpp +++ b/lib/Support/MemoryBuffer.cpp @@ -46,7 +46,7 @@ MemoryBuffer::~MemoryBuffer() { /// successfully. void MemoryBuffer::initCopyOf(const char *BufStart, const char *BufEnd) { size_t Size = BufEnd-BufStart; - BufferStart = (char *)malloc((Size+1) * sizeof(char)); + BufferStart = (char *)malloc(Size+1); BufferEnd = BufferStart+Size; memcpy(const_cast<char*>(BufferStart), BufStart, Size); *const_cast<char*>(BufferEnd) = 0; // Null terminate buffer. @@ -108,7 +108,7 @@ MemoryBuffer *MemoryBuffer::getMemBufferCopy(const char *StartPtr, /// the MemoryBuffer object. MemoryBuffer *MemoryBuffer::getNewUninitMemBuffer(size_t Size, StringRef BufferName) { - char *Buf = (char *)malloc((Size+1) * sizeof(char)); + char *Buf = (char *)malloc(Size+1); if (!Buf) return 0; Buf[Size] = 0; MemoryBufferMem *SB = new MemoryBufferMem(Buf, Buf+Size, BufferName); |