[llvm-commits] [llvm] r92079 - /llvm/trunk/lib/Support/MemoryBuffer.cpp
Chris Lattner
sabre at nondot.org
Wed Dec 23 15:03:24 PST 2009
Author: lattner
Date: Wed Dec 23 17:03:24 2009
New Revision: 92079
URL: http://llvm.org/viewvc/llvm-project?rev=92079&view=rev
Log:
sizeof(char) is always 1.
Modified:
llvm/trunk/lib/Support/MemoryBuffer.cpp
Modified: llvm/trunk/lib/Support/MemoryBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/MemoryBuffer.cpp?rev=92079&r1=92078&r2=92079&view=diff
==============================================================================
--- llvm/trunk/lib/Support/MemoryBuffer.cpp (original)
+++ llvm/trunk/lib/Support/MemoryBuffer.cpp Wed Dec 23 17:03:24 2009
@@ -46,7 +46,7 @@
/// 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 @@
/// 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);
More information about the llvm-commits
mailing list