1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-19 20:16:10 +08:00

Rename UtlMemory_* to UtlVectorMemory_*

This commit is contained in:
GAMMACASE
2025-07-31 19:58:46 +03:00
parent e32289e065
commit bc8ed15fef

View File

@ -643,9 +643,9 @@ inline bool CUtlMemory<T,I>::IsIdxValid( I i ) const
return ( x >= 0 ) && ( x < m_nAllocationCount );
}
PLATFORM_INTERFACE int UtlMemory_CalcNewAllocationCount( int nAllocationCount, int nGrowSize, int nNewSize, int nBytesItem );
PLATFORM_INTERFACE void* UtlMemory_Alloc( void* pMem, bool bRealloc, int nNewSize, int nOldSize );
PLATFORM_INTERFACE void UtlMemory_FailedAllocation( int nTotalElements, int nNewElements );
PLATFORM_INTERFACE int UtlVectorMemory_CalcNewAllocationCount( int nAllocationCount, int nGrowSize, int nNewSize, int nBytesItem );
PLATFORM_INTERFACE void* UtlVectorMemory_Alloc( void* pMem, bool bRealloc, int nNewSize, int nOldSize );
PLATFORM_INTERFACE void UtlVectorMemory_FailedAllocation( int nTotalElements, int nNewElements );
//-----------------------------------------------------------------------------
// Grows the memory
@ -663,7 +663,7 @@ void CUtlMemory<T,I>::Grow( int num )
}
if ( ( ( int64 )m_nAllocationCount + num ) > INT_MAX )
UtlMemory_FailedAllocation( m_nAllocationCount, num );
UtlVectorMemory_FailedAllocation( m_nAllocationCount, num );
// Make sure we have at least numallocated + num allocations.
// Use the grow rules specified for this memory (in m_nGrowSize)
@ -671,7 +671,7 @@ void CUtlMemory<T,I>::Grow( int num )
UTLMEMORY_TRACK_FREE();
int nNewAllocationCount = UtlMemory_CalcNewAllocationCount( m_nAllocationCount, m_nGrowSize & ~(EXTERNAL_CONST_BUFFER_MARKER | EXTERNAL_BUFFER_MARKER), nAllocationRequested, sizeof(T) );
int nNewAllocationCount = UtlVectorMemory_CalcNewAllocationCount( m_nAllocationCount, m_nGrowSize & ~(EXTERNAL_CONST_BUFFER_MARKER | EXTERNAL_BUFFER_MARKER), nAllocationRequested, sizeof(T) );
// if m_nAllocationRequested wraps index type I, recalculate
if ( ( int )( I )nNewAllocationCount < nAllocationRequested )
@ -696,7 +696,7 @@ void CUtlMemory<T,I>::Grow( int num )
}
MEM_ALLOC_CREDIT_CLASS();
m_pMemory = (T*)UtlMemory_Alloc( m_pMemory, !IsExternallyAllocated(), nNewAllocationCount * sizeof(T), m_nAllocationCount * sizeof(T) );
m_pMemory = (T*)UtlVectorMemory_Alloc( m_pMemory, !IsExternallyAllocated(), nNewAllocationCount * sizeof(T), m_nAllocationCount * sizeof(T) );
Assert( m_pMemory );
if ( IsExternallyAllocated() )
@ -727,7 +727,7 @@ inline void CUtlMemory<T,I>::EnsureCapacity( int num )
UTLMEMORY_TRACK_FREE();
MEM_ALLOC_CREDIT_CLASS();
m_pMemory = (T*)UtlMemory_Alloc( m_pMemory, !IsExternallyAllocated(), num * sizeof(T), m_nAllocationCount * sizeof(T) );
m_pMemory = (T*)UtlVectorMemory_Alloc( m_pMemory, !IsExternallyAllocated(), num * sizeof(T), m_nAllocationCount * sizeof(T) );
if ( IsExternallyAllocated() )
m_nGrowSize &= ~(EXTERNAL_CONST_BUFFER_MARKER | EXTERNAL_BUFFER_MARKER);
@ -798,7 +798,7 @@ void CUtlMemory<T,I>::Purge( int numElements )
UTLMEMORY_TRACK_FREE();
MEM_ALLOC_CREDIT_CLASS();
m_pMemory = (T*)UtlMemory_Alloc( m_pMemory, !IsExternallyAllocated(), numElements * sizeof(T), m_nAllocationCount * sizeof(T) );
m_pMemory = (T*)UtlVectorMemory_Alloc( m_pMemory, !IsExternallyAllocated(), numElements * sizeof(T), m_nAllocationCount * sizeof(T) );
if ( IsExternallyAllocated() )
m_nGrowSize &= ~(EXTERNAL_CONST_BUFFER_MARKER | EXTERNAL_BUFFER_MARKER);
@ -954,7 +954,7 @@ void CUtlMemoryAligned<T, nAlignment>::Grow( int num )
// Use the grow rules specified for this memory (in m_nGrowSize)
int nAllocationRequested = CUtlMemory<T>::m_nAllocationCount + num;
CUtlMemory<T>::m_nAllocationCount = UtlMemory_CalcNewAllocationCount( CUtlMemory<T>::m_nAllocationCount, CUtlMemory<T>::m_nGrowSize, nAllocationRequested, sizeof(T) );
CUtlMemory<T>::m_nAllocationCount = UtlVectorMemory_CalcNewAllocationCount( CUtlMemory<T>::m_nAllocationCount, CUtlMemory<T>::m_nGrowSize, nAllocationRequested, sizeof(T) );
UTLMEMORY_TRACK_ALLOC();