mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-12-07 02:28:22 +00:00
Finished ResetDbgInfo/m_pElements removal on data structures
This commit is contained in:
parent
0d4a232fc6
commit
d306f68e6b
@ -52,7 +52,7 @@ public:
|
||||
// Set the size by which the memory grows - round up to the next power of 2
|
||||
void Init( int nGrowSize = 0, int nInitSize = 0 );
|
||||
|
||||
// here to match CUtlMemory, but only used by ResetDbgInfo, so it can just return NULL
|
||||
// here to match CUtlMemory, but not used, so it can just return NULL
|
||||
T* Base() { return NULL; }
|
||||
const T* Base() const { return NULL; }
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ public:
|
||||
// Set the size by which the memory grows
|
||||
void Init( int nGrowSize = 0, int nInitSize = 0 );
|
||||
|
||||
// here to match CUtlMemory, but only used by ResetDbgInfo, so it can just return NULL
|
||||
// here to match CUtlMemory, but not used, so it can just return NULL
|
||||
T* Base() { return NULL; }
|
||||
const T* Base() const { return NULL; }
|
||||
|
||||
|
||||
@ -201,7 +201,6 @@ public:
|
||||
|
||||
private:
|
||||
int MaxElementIndex() const { Assert( 0 ); return this->InvalidIndex(); } // fixedmemory containers don't support iteration from 0..maxelements-1
|
||||
void ResetDbgInfo() {}
|
||||
};
|
||||
|
||||
// this is kind of ugly, but until C++ gets templatized typedefs in C++0x, it's our only choice
|
||||
@ -211,8 +210,6 @@ class CUtlBlockLinkedList : public CUtlLinkedList< T, I, true, I, CUtlBlockMemor
|
||||
public:
|
||||
CUtlBlockLinkedList( int growSize = 0, int initSize = 0 )
|
||||
: CUtlLinkedList< T, I, true, I, CUtlBlockMemory< UtlLinkedListElem_t< T, I >, I > >( growSize, initSize ) {}
|
||||
protected:
|
||||
void ResetDbgInfo() {}
|
||||
};
|
||||
|
||||
|
||||
@ -227,7 +224,6 @@ CUtlLinkedList<T,S,ML,I,M>::CUtlLinkedList( int growSize, int initSize ) :
|
||||
// Prevent signed non-int datatypes
|
||||
COMPILE_TIME_ASSERT( sizeof(S) == 4 || ( ( (S)-1 ) > 0 ) );
|
||||
ConstructList();
|
||||
ResetDbgInfo();
|
||||
}
|
||||
|
||||
template <class T, class S, bool ML, class I, class M>
|
||||
@ -394,7 +390,6 @@ void CUtlLinkedList<T,S,ML,I,M>::EnsureCapacity( int num )
|
||||
{
|
||||
MEM_ALLOC_CREDIT_CLASS();
|
||||
m_Memory.EnsureCapacity(num);
|
||||
ResetDbgInfo();
|
||||
}
|
||||
|
||||
template< class T, class S, bool ML, class I, class M >
|
||||
@ -402,7 +397,6 @@ void CUtlLinkedList<T,S,ML,I,M>::SetGrowSize( int growSize )
|
||||
{
|
||||
RemoveAll();
|
||||
m_Memory.Init( growSize );
|
||||
ResetDbgInfo();
|
||||
}
|
||||
|
||||
|
||||
@ -422,7 +416,6 @@ void CUtlLinkedList<T,S,ML,I,M>::Purge()
|
||||
//Routing "m_LastAlloc = m_Memory.InvalidIterator();" through a local const to sidestep an internal compiler error on 360 builds
|
||||
const typename M::Iterator_t scInvalidIterator = m_Memory.InvalidIterator();
|
||||
m_LastAlloc = scInvalidIterator;
|
||||
ResetDbgInfo();
|
||||
}
|
||||
|
||||
|
||||
@ -461,7 +454,6 @@ I CUtlLinkedList<T,S,ML,I,M>::AllocInternal( bool multilist ) RESTRICT
|
||||
{
|
||||
MEM_ALLOC_CREDIT_CLASS();
|
||||
m_Memory.Grow();
|
||||
ResetDbgInfo();
|
||||
|
||||
it = m_Memory.IsValidIterator( m_LastAlloc ) ? m_Memory.Next( m_LastAlloc ) : m_Memory.First();
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//========= Copyright <EFBFBD> 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Multiple linked list container class
|
||||
//
|
||||
@ -145,30 +145,6 @@ protected:
|
||||
I m_FirstFree;
|
||||
I m_TotalElements;
|
||||
int m_MaxElementIndex; // The number allocated (use int so we can catch overflow)
|
||||
|
||||
void ResetDbgInfo()
|
||||
{
|
||||
m_pElements = m_Memory.Base();
|
||||
|
||||
#ifdef _DEBUG
|
||||
// Allocate space for the element list (which list is each element in)
|
||||
if (m_Memory.NumAllocated() > 0)
|
||||
{
|
||||
if (!m_pElementList)
|
||||
{
|
||||
m_pElementList = (I*)malloc( m_Memory.NumAllocated() * sizeof(I) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pElementList = (I*)realloc( m_pElementList, m_Memory.NumAllocated() * sizeof(I) );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// For debugging purposes;
|
||||
// it's in release builds so this can be used in libraries correctly
|
||||
ListElem_t *m_pElements;
|
||||
};
|
||||
|
||||
|
||||
@ -204,7 +180,6 @@ void CUtlMultiList<T,I>::ConstructList( )
|
||||
m_FirstFree = InvalidIndex();
|
||||
m_TotalElements = 0;
|
||||
m_MaxElementIndex = 0;
|
||||
ResetDbgInfo();
|
||||
}
|
||||
|
||||
|
||||
@ -366,7 +341,6 @@ template< class T, class I >
|
||||
void CUtlMultiList<T, I>::EnsureCapacity( int num )
|
||||
{
|
||||
m_Memory.EnsureCapacity(num);
|
||||
ResetDbgInfo();
|
||||
}
|
||||
|
||||
|
||||
@ -383,7 +357,6 @@ void CUtlMultiList<T,I>::Purge()
|
||||
m_FirstFree = InvalidIndex();
|
||||
m_TotalElements = 0;
|
||||
m_MaxElementIndex = 0;
|
||||
ResetDbgInfo();
|
||||
}
|
||||
|
||||
|
||||
@ -409,7 +382,6 @@ I CUtlMultiList<T,I>::Alloc( )
|
||||
if (m_MaxElementIndex == m_Memory.NumAllocated())
|
||||
{
|
||||
m_Memory.Grow();
|
||||
ResetDbgInfo();
|
||||
|
||||
if ( m_MaxElementIndex >= m_Memory.NumAllocated() )
|
||||
{
|
||||
|
||||
@ -117,11 +117,6 @@ protected:
|
||||
// Gets at the node element....
|
||||
Node_t& InternalNode( I i ) { return m_Memory[i]; }
|
||||
const Node_t& InternalNode( I i ) const { return m_Memory[i]; }
|
||||
|
||||
void ResetDbgInfo()
|
||||
{
|
||||
m_pElements = m_Memory.Base();
|
||||
}
|
||||
|
||||
// copy constructors not allowed
|
||||
CUtlNTree( CUtlNTree<T, I> const& tree ) { Assert(0); }
|
||||
@ -131,10 +126,6 @@ protected:
|
||||
I m_FirstFree;
|
||||
I m_ElementCount; // The number actually in the tree
|
||||
I m_MaxElementIndex; // The max index we've ever assigned
|
||||
|
||||
// For debugging purposes;
|
||||
// it's in release builds so this can be used in libraries correctly
|
||||
Node_t *m_pElements;
|
||||
};
|
||||
|
||||
|
||||
@ -147,7 +138,6 @@ CUtlNTree<T,I>::CUtlNTree( int growSize, int initSize ) :
|
||||
m_Memory(growSize, initSize)
|
||||
{
|
||||
ConstructList();
|
||||
ResetDbgInfo();
|
||||
}
|
||||
|
||||
template <class T, class I>
|
||||
@ -155,7 +145,6 @@ CUtlNTree<T,I>::CUtlNTree( void* pMemory, int memsize ) :
|
||||
m_Memory(pMemory, memsize/sizeof(T))
|
||||
{
|
||||
ConstructList();
|
||||
ResetDbgInfo();
|
||||
}
|
||||
|
||||
template <class T, class I>
|
||||
@ -279,7 +268,6 @@ void CUtlNTree<T, I>::EnsureCapacity( int num )
|
||||
{
|
||||
MEM_ALLOC_CREDIT_CLASS();
|
||||
m_Memory.EnsureCapacity(num);
|
||||
ResetDbgInfo();
|
||||
}
|
||||
|
||||
|
||||
@ -293,7 +281,6 @@ void CUtlNTree<T,I>::Purge()
|
||||
m_Memory.Purge( );
|
||||
m_FirstFree = InvalidIndex();
|
||||
m_MaxElementIndex = 0;
|
||||
ResetDbgInfo();
|
||||
}
|
||||
|
||||
|
||||
@ -333,7 +320,6 @@ I CUtlNTree<T,I>::AllocInternal( )
|
||||
|
||||
Node_t &node = InternalNode( elem );
|
||||
node.m_NextSibling = node.m_PrevSibling = node.m_Parent = node.m_FirstChild = INVALID_NTREE_IDX;
|
||||
ResetDbgInfo();
|
||||
|
||||
// one more element baby
|
||||
++m_ElementCount;
|
||||
|
||||
@ -287,18 +287,10 @@ protected:
|
||||
I m_FirstFree;
|
||||
typename M::Iterator_t m_LastAlloc; // the last index allocated
|
||||
|
||||
Node_t* m_pElements;
|
||||
|
||||
FORCEINLINE M const &Elements( void ) const
|
||||
{
|
||||
return m_Elements;
|
||||
}
|
||||
|
||||
|
||||
void ResetDbgInfo()
|
||||
{
|
||||
m_pElements = (Node_t*)m_Elements.Base();
|
||||
}
|
||||
};
|
||||
|
||||
// this is kind of ugly, but until C++ gets templatized typedefs in C++0x, it's our only choice
|
||||
@ -331,9 +323,6 @@ public:
|
||||
return LeftChild(i) != i;
|
||||
}
|
||||
|
||||
protected:
|
||||
void ResetDbgInfo() {}
|
||||
|
||||
private:
|
||||
// this doesn't make sense for fixed rbtrees, since there's no useful max pointer, and the index space isn't contiguous anyways
|
||||
I MaxElement() const;
|
||||
@ -349,8 +338,6 @@ public:
|
||||
: CUtlRBTree< T, I, L, CUtlBlockMemory< UtlRBTreeNode_t< T, I >, I > >( growSize, initSize, lessfunc ) {}
|
||||
CUtlBlockRBTree( const LessFunc_t &lessfunc )
|
||||
: CUtlRBTree< T, I, L, CUtlBlockMemory< UtlRBTreeNode_t< T, I >, I > >( lessfunc ) {}
|
||||
protected:
|
||||
void ResetDbgInfo() {}
|
||||
};
|
||||
|
||||
|
||||
@ -367,7 +354,6 @@ m_NumElements( 0 ),
|
||||
m_FirstFree( InvalidIndex() ),
|
||||
m_LastAlloc( m_Elements.InvalidIterator() )
|
||||
{
|
||||
ResetDbgInfo();
|
||||
}
|
||||
|
||||
template < class T, class I, typename L, class M >
|
||||
@ -379,7 +365,6 @@ m_NumElements( 0 ),
|
||||
m_FirstFree( InvalidIndex() ),
|
||||
m_LastAlloc( m_Elements.InvalidIterator() )
|
||||
{
|
||||
ResetDbgInfo();
|
||||
}
|
||||
|
||||
template < class T, class I, typename L, class M >
|
||||
@ -405,7 +390,6 @@ inline void CUtlRBTree<T, I, L, M>::CopyFrom( const CUtlRBTree<T, I, L, M> &othe
|
||||
m_NumElements = other.m_NumElements;
|
||||
m_FirstFree = other.m_FirstFree;
|
||||
m_LastAlloc = other.m_LastAlloc;
|
||||
ResetDbgInfo();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -692,7 +676,6 @@ I CUtlRBTree<T, I, L, M>::NewNode()
|
||||
#endif
|
||||
|
||||
Construct( &Element( elem ) );
|
||||
ResetDbgInfo();
|
||||
|
||||
return elem;
|
||||
}
|
||||
@ -1562,7 +1545,6 @@ void CUtlRBTree<T, I, L, M>::Swap( CUtlRBTree< T, I, L > &that )
|
||||
V_swap( m_Root, that.m_Root );
|
||||
V_swap( m_NumElements, that.m_NumElements );
|
||||
V_swap( m_FirstFree, that.m_FirstFree );
|
||||
V_swap( m_pElements, that.m_pElements );
|
||||
V_swap( m_LastAlloc, that.m_LastAlloc );
|
||||
Assert( IsValid() );
|
||||
Assert( m_Elements.IsValidIterator( m_LastAlloc ) || ( m_NumElements == 0 && m_FirstFree == InvalidIndex() ) );
|
||||
|
||||
Loading…
Reference in New Issue
Block a user