[llvm-commits] [llvm] r52927 - /llvm/trunk/include/llvm/ADT/SmallVector.h
Dan Gohman
gohman at apple.com
Mon Jun 30 14:33:03 PDT 2008
Author: djg
Date: Mon Jun 30 16:33:02 2008
New Revision: 52927
URL: http://llvm.org/viewvc/llvm-project?rev=52927&view=rev
Log:
Use plain operator new instead of new char[].
Modified:
llvm/trunk/include/llvm/ADT/SmallVector.h
Modified: llvm/trunk/include/llvm/ADT/SmallVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=52927&r1=52926&r2=52927&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallVector.h Mon Jun 30 16:33:02 2008
@@ -84,7 +84,7 @@
// If this wasn't grown from the inline copy, deallocate the old space.
if (!isSmall())
- delete[] reinterpret_cast<char*>(Begin);
+ operator delete(static_cast<void*>(Begin));
}
typedef size_t size_type;
@@ -317,8 +317,8 @@
/// isSmall - Return true if this is a smallvector which has not had dynamic
/// memory allocated for it.
bool isSmall() const {
- return reinterpret_cast<const void*>(Begin) ==
- reinterpret_cast<const void*>(&FirstEl);
+ return static_cast<const void*>(Begin) ==
+ static_cast<const void*>(&FirstEl);
}
/// grow - double the size of the allocated memory, guaranteeing space for at
@@ -346,7 +346,7 @@
size_t NewCapacity = 2*CurCapacity;
if (NewCapacity < MinSize)
NewCapacity = MinSize;
- T *NewElts = reinterpret_cast<T*>(new char[NewCapacity*sizeof(T)]);
+ T *NewElts = static_cast<T*>(operator new(NewCapacity*sizeof(T)));
// Copy the elements over.
std::uninitialized_copy(Begin, End, NewElts);
@@ -356,7 +356,7 @@
// If this wasn't grown from the inline copy, deallocate the old space.
if (!isSmall())
- delete[] reinterpret_cast<char*>(Begin);
+ operator delete(static_cast<void*>(Begin));
Begin = NewElts;
End = NewElts+CurSize;
More information about the llvm-commits
mailing list