mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-09-19 12:06:07 +08:00
Remove IMemAlloc dbg variants
Alloc, Realloc & Free dbg variants doesn't seem to appear in the engine now, yet they pollute virtual function list due to them being overloads with the same name thus causing random crashes if called
This commit is contained in:

committed by
Nicholas Hastings

parent
d525e7ad19
commit
25ff538f57
@ -81,21 +81,24 @@ public:
|
|||||||
virtual void Free( void *pMem ) = 0;
|
virtual void Free( void *pMem ) = 0;
|
||||||
// virtual void *Expand_NoLongerSupported( void *pMem, size_t nSize ) = 0;
|
// virtual void *Expand_NoLongerSupported( void *pMem, size_t nSize ) = 0;
|
||||||
|
|
||||||
private:
|
|
||||||
// Debug versions
|
|
||||||
virtual void *Alloc( size_t nSize, const char *pFileName, int nLine ) = 0;
|
|
||||||
public:
|
|
||||||
virtual void *Realloc( void *pMem, size_t nSize, const char *pFileName, int nLine ) = 0;
|
|
||||||
virtual void Free( void *pMem, const char *pFileName, int nLine ) = 0;
|
|
||||||
// virtual void *Expand_NoLongerSupported( void *pMem, size_t nSize, const char *pFileName, int nLine ) = 0;
|
|
||||||
|
|
||||||
inline void *IndirectAlloc( size_t nSize ) { return Alloc( nSize ); }
|
|
||||||
inline void *IndirectAlloc( size_t nSize, const char *pFileName, int nLine ) { return Alloc( nSize, pFileName, nLine ); }
|
|
||||||
|
|
||||||
// =================================================================
|
// =================================================================
|
||||||
// GAMMACASE: Interface structure beyond this point is incorrect and any usage of the functions below should be discouraged!!!
|
// GAMMACASE: Interface structure beyond this point is incorrect and any usage of the functions below should be discouraged!!!
|
||||||
// =================================================================
|
// =================================================================
|
||||||
|
|
||||||
|
// GAMMACASE: Seems like the debug versions are gone now, or atleast they aren't here anymore
|
||||||
|
// leaving them all here for future reference, but these shouldn't be used anymore!
|
||||||
|
// renamed with a postfix "2" otherwise they would be placed near the first functions in the virtual list
|
||||||
|
private:
|
||||||
|
// Debug versions
|
||||||
|
virtual void *Alloc2( size_t nSize, const char *pFileName, int nLine ) = 0;
|
||||||
|
public:
|
||||||
|
virtual void *Realloc2( void *pMem, size_t nSize, const char *pFileName, int nLine ) = 0;
|
||||||
|
virtual void Free2( void *pMem, const char *pFileName, int nLine ) = 0;
|
||||||
|
// virtual void *Expand_NoLongerSupported( void *pMem, size_t nSize, const char *pFileName, int nLine ) = 0;
|
||||||
|
|
||||||
|
inline void *IndirectAlloc( size_t nSize ) { return Alloc( nSize ); }
|
||||||
|
// inline void *IndirectAlloc( size_t nSize, const char *pFileName, int nLine ) { return Alloc( nSize, pFileName, nLine ); }
|
||||||
|
|
||||||
// Returns size of a particular allocation
|
// Returns size of a particular allocation
|
||||||
virtual size_t GetSize( void *pMem ) = 0;
|
virtual size_t GetSize( void *pMem ) = 0;
|
||||||
|
|
||||||
@ -189,7 +192,7 @@ inline void *MemAlloc_Alloc( size_t nSize )
|
|||||||
|
|
||||||
inline void *MemAlloc_Alloc( size_t nSize, const char *pFileName, int nLine )
|
inline void *MemAlloc_Alloc( size_t nSize, const char *pFileName, int nLine )
|
||||||
{
|
{
|
||||||
return g_pMemAlloc->IndirectAlloc( nSize, pFileName, nLine );
|
return g_pMemAlloc->IndirectAlloc( nSize /*, pFileName, nLine*/ );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
inline void MemAlloc_Free( void *ptr )
|
inline void MemAlloc_Free( void *ptr )
|
||||||
@ -198,7 +201,7 @@ inline void MemAlloc_Free( void *ptr )
|
|||||||
}
|
}
|
||||||
inline void MemAlloc_Free( void *ptr, const char *pFileName, int nLine )
|
inline void MemAlloc_Free( void *ptr, const char *pFileName, int nLine )
|
||||||
{
|
{
|
||||||
g_pMemAlloc->Free( ptr, pFileName, nLine );
|
g_pMemAlloc->Free( ptr /*, pFileName, nLine*/ );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -321,7 +324,7 @@ inline void MemAlloc_FreeAligned( void *pMemBlock, const char *pszFile, int nLin
|
|||||||
|
|
||||||
// pAlloc is the pointer to the start of memory block
|
// pAlloc is the pointer to the start of memory block
|
||||||
pAlloc = *( (void **)pAlloc );
|
pAlloc = *( (void **)pAlloc );
|
||||||
g_pMemAlloc->Free( pAlloc, pszFile, nLine );
|
g_pMemAlloc->Free( pAlloc/*, pszFile, nLine*/ );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t MemAlloc_GetSizeAligned( void *pMemBlock )
|
inline size_t MemAlloc_GetSizeAligned( void *pMemBlock )
|
||||||
|
@ -120,7 +120,7 @@ extern const char *g_pszModule;
|
|||||||
#if defined(USE_MEM_DEBUG)
|
#if defined(USE_MEM_DEBUG)
|
||||||
|
|
||||||
#define malloc(s) MemAlloc_Alloc( s, __FILE__, __LINE__)
|
#define malloc(s) MemAlloc_Alloc( s, __FILE__, __LINE__)
|
||||||
#define realloc(p, s) g_pMemAlloc->Realloc( p, s, __FILE__, __LINE__ )
|
#define realloc(p, s) g_pMemAlloc->Realloc( p, s/*, __FILE__, __LINE__*/ )
|
||||||
#define _aligned_malloc( s, a ) MemAlloc_AllocAlignedFileLine( s, a, __FILE__, __LINE__ )
|
#define _aligned_malloc( s, a ) MemAlloc_AllocAlignedFileLine( s, a, __FILE__, __LINE__ )
|
||||||
|
|
||||||
#define _malloc_dbg(s, t, f, l) WHYCALLINGTHISDIRECTLY(s)
|
#define _malloc_dbg(s, t, f, l) WHYCALLINGTHISDIRECTLY(s)
|
||||||
|
Reference in New Issue
Block a user