From c095927afba30ba74b5390ab32139ab09ab78d32 Mon Sep 17 00:00:00 2001 From: ejcoumans Date: Tue, 19 Jun 2007 23:45:10 +0000 Subject: [PATCH] don't check twice, thanks Marten Svanfeldt >>2. reserve(int) method check capacity() < _Count twice. --- src/LinearMath/btAlignedObjectArray.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/LinearMath/btAlignedObjectArray.h b/src/LinearMath/btAlignedObjectArray.h index ea46f6ecf..ac86b5466 100644 --- a/src/LinearMath/btAlignedObjectArray.h +++ b/src/LinearMath/btAlignedObjectArray.h @@ -216,21 +216,18 @@ class btAlignedObjectArray { // determine new minimum length of allocated storage if (capacity() < _Count) { // not enough room, reallocate - if (capacity() < _Count) - { - T* s = (T*)allocate(_Count); + T* s = (T*)allocate(_Count); - copy(0, size(), s); + copy(0, size(), s); - destroy(0,size()); + destroy(0,size()); - deallocate(); + deallocate(); - m_data = s; - - m_capacity = _Count; + m_data = s; + + m_capacity = _Count; - } } }