You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2008/10/21 18:32:24 UTC
svn commit: r706678 - /xalan/c/trunk/src/xalanc/Include/XalanVector.hpp
Author: dbertoni
Date: Tue Oct 21 09:32:23 2008
New Revision: 706678
URL: http://svn.apache.org/viewvc?rev=706678&view=rev
Log:
Broke up some functions for better inlining.
Modified:
xalan/c/trunk/src/xalanc/Include/XalanVector.hpp
Modified: xalan/c/trunk/src/xalanc/Include/XalanVector.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/Include/XalanVector.hpp?rev=706678&r1=706677&r2=706678&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/Include/XalanVector.hpp (original)
+++ xalan/c/trunk/src/xalanc/Include/XalanVector.hpp Tue Oct 21 09:32:23 2008
@@ -587,7 +587,8 @@
}
void
- resize( size_type theSize,
+ resize(
+ size_type theSize,
const value_type& theValue)
{
invariants();
@@ -974,28 +975,73 @@
}
void
+ grow(const value_type& data)
+ {
+ invariants();
+
+ assert(m_size != 0 && m_size == m_allocation);
+
+ const size_type theNewSize = size_type((m_size * 1.6) + 0.5);
+ assert(theNewSize > m_size);
+
+ ThisType theTemp(*this, *m_memoryManager, theNewSize);
+
+ theTemp.doPushBack(data);
+
+ swap(theTemp);
+
+ invariants();
+ }
+
+ void
+ construct_back(const value_type& data)
+ {
+ invariants();
+
+ assert(m_size < m_allocation);
+
+ Constructor::construct(
+ endPointer(),
+ data,
+ *m_memoryManager);
+
+ ++m_size;
+
+ invariants();
+ }
+
+ void
+ init(const value_type& data)
+ {
+ invariants();
+
+ assert(m_size == 0 && m_allocation == 0);
+
+ m_data = allocate(1);
+
+ m_allocation = 1;
+
+ construct_back(data);
+
+ invariants();
+ }
+
+ void
doPushBack(const value_type& data)
{
invariants();
if (m_size < m_allocation)
{
- Constructor::construct(endPointer(), data, *m_memoryManager);
-
- ++m_size;
+ construct_back(data);
+ }
+ else if (m_size == 0)
+ {
+ init(data);
}
else
{
- assert(m_size == m_allocation);
-
- const size_type theNewSize = m_size == 0 ? 1 : size_type((m_size * 1.6) + 0.5);
- assert(theNewSize > m_size);
-
- ThisType theTemp(*this, *m_memoryManager, theNewSize);
-
- theTemp.doPushBack(data);
-
- swap(theTemp);
+ grow(data);
}
invariants();
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org