Browse Source

osx : malloc.h => malloc/malloc.h

pull/71/head
hymei 2 years ago committed by nillerusr
parent
commit
ff588a8810
  1. 1
      bitmap/colorconversion.cpp
  2. 1
      bitmap/imageformat.cpp
  3. 1
      bitmap/resample.cpp
  4. 1
      bitmap/tgawriter.cpp
  5. 4
      common/GameUI/ObjectList.cpp
  6. 2
      common/freetype/config/ftconfig.h
  7. 4
      engine/common.cpp
  8. 4
      engine/decals.cpp
  9. 1
      engine/materialproxyfactory.cpp
  10. 4
      engine/packed_entity.cpp
  11. 4
      engine/pr_edict.cpp
  12. 7
      engine/zone.cpp
  13. 2
      materialsystem/CMaterialSubRect.cpp
  14. 4
      materialsystem/cmaterial.cpp
  15. 1
      materialsystem/materialsystem_global.cpp
  16. 4
      materialsystem/pch_materialsystem.h
  17. 1
      materialsystem/shaderapidx9/shaderapidx8.cpp
  18. 1
      public/builddisp.cpp
  19. 2
      public/saverestoretypes.h
  20. 15
      public/tier0/memalloc.h
  21. 4
      public/tier0/memdbgon.h
  22. 2
      public/tier1/mempool.h
  23. 4
      public/vallocator.cpp
  24. 4
      public/vstdlib/pch_vstdlib.h
  25. 1
      studiorender/r_studiodraw.cpp
  26. 6
      tier0/dbg.cpp
  27. 4
      tier0/mem.cpp
  28. 4
      tier0/mem_helpers.cpp
  29. 36
      tier0/memdbg.cpp
  30. 4
      tier0/memstd.cpp
  31. 8
      tier0/memstd.h
  32. 8
      tier0/memvalidate.cpp
  33. 4
      tier0/pch_tier0.h
  34. 10
      tier0/platform_posix.cpp
  35. 4
      tier1/mempool.cpp
  36. 4
      vgui2/src/vgui.cpp
  37. 4
      vgui2/vgui_controls/TextImage.cpp
  38. 4
      vgui2/vgui_surfacelib/BitmapFont.cpp
  39. 4
      vgui2/vgui_surfacelib/linuxfont.cpp
  40. 21
      vguimatsurface/MatSystemSurface.cpp

1
bitmap/colorconversion.cpp

@ -10,7 +10,6 @@ @@ -10,7 +10,6 @@
#include "bitmap/imageformat.h"
#include "basetypes.h"
#include "tier0/dbg.h"
#include <malloc.h>
#include <memory.h>
#include "mathlib/mathlib.h"
#include "mathlib/vector.h"

1
bitmap/imageformat.cpp

@ -11,7 +11,6 @@ @@ -11,7 +11,6 @@
#include "bitmap/imageformat.h"
#include "basetypes.h"
#include "tier0/dbg.h"
#include <malloc.h>
#include <memory.h>
#include "nvtc.h"
#include "mathlib/mathlib.h"

1
bitmap/resample.cpp

@ -8,7 +8,6 @@ @@ -8,7 +8,6 @@
#include "bitmap/imageformat.h"
#include "basetypes.h"
#include "tier0/dbg.h"
#include <malloc.h>
#include <memory.h>
#include "mathlib/mathlib.h"
#include "mathlib/vector.h"

1
bitmap/tgawriter.cpp

@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
#include <stdlib.h>
#include <stdio.h>
#include "tier0/dbg.h"
#include <malloc.h>
#include "filesystem.h"
#include "bitmap/tgawriter.h"
#include "tier1/utlbuffer.h"

4
common/GameUI/ObjectList.cpp

@ -6,7 +6,11 @@ @@ -6,7 +6,11 @@
//
//=============================================================================//
#include <stdio.h>
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include "ObjectList.h"
#include "tier1/strtools.h"

2
common/freetype/config/ftconfig.h

@ -3,6 +3,8 @@ @@ -3,6 +3,8 @@
#ifdef ANDROID
#include <sys/cdefs.h>
#elif defined(OSX)
#include <stdint.h>
#else
#include <bits/wordsize.h>
#endif

4
engine/common.cpp

@ -16,7 +16,11 @@ @@ -16,7 +16,11 @@
#include <characterset.h>
#include <bitbuf.h>
#include "common.h"
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include "traceinit.h"
#include <filesystem.h>
#include "filesystem_engine.h"

4
engine/decals.cpp

@ -14,7 +14,11 @@ @@ -14,7 +14,11 @@
#include "filesystem.h"
#include "filesystem_engine.h"
#include "materialsystem/imaterial.h"
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include "utldict.h"
// memdbgon must be the last include file in a .cpp file!!!

1
engine/materialproxyfactory.cpp

@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
//=============================================================================//
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include "materialsystem/imaterialproxy.h"
#include "materialproxyfactory.h"

4
engine/packed_entity.cpp

@ -5,7 +5,11 @@ @@ -5,7 +5,11 @@
// $NoKeywords: $
//
//=============================================================================//
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include <string.h>
#include <assert.h>
#include "packed_entity.h"

4
engine/pr_edict.cpp

@ -32,7 +32,11 @@ @@ -32,7 +32,11 @@
#ifdef _DEBUG
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#endif // _DEBUG
static ConVar sv_useexplicitdelete( "sv_useexplicitdelete", "1", FCVAR_DEVELOPMENTONLY, "Explicitly delete dormant client entities caused by AllowImmediateReuse()." );

7
engine/zone.cpp

@ -133,7 +133,14 @@ void Hunk_Print() @@ -133,7 +133,14 @@ void Hunk_Print()
void Memory_Init( void )
{
MEM_ALLOC_CREDIT();
#ifdef PLATFORM_64BITS
// Seems to need to be larger to not get exhausted on
// 64-bit. Perhaps because of larger pointer sizes.
int nMaxBytes = 128*1024*1024;
#else
int nMaxBytes = 48*1024*1024;
#endif
const int nMinCommitBytes = 0x8000;
#ifndef HUNK_USE_16MB_PAGE
const int nInitialCommit = 0x280000;

2
materialsystem/CMaterialSubRect.cpp

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
#include "materialsystem/imaterialproxyfactory.h"
#include "IHardwareConfigInternal.h"
#include "utlsymbol.h"
#include <malloc.h>
#include <stdlib.h>
#include "filesystem.h"
#include <KeyValues.h>
#include "mempool.h"

4
materialsystem/cmaterial.cpp

@ -17,7 +17,11 @@ @@ -17,7 +17,11 @@
#include "materialsystem/imaterialproxyfactory.h"
#include "IHardwareConfigInternal.h"
#include "utlsymbol.h"
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include "filesystem.h"
#include <KeyValues.h>
#include "mempool.h"

1
materialsystem/materialsystem_global.cpp

@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
#include "materialsystem_global.h"
#include "shaderapi/ishaderapi.h"
#include "shadersystem.h"
#include <malloc.h>
#include "filesystem.h"
// memdbgon must be the last include file in a .cpp file!!!

4
materialsystem/pch_materialsystem.h

@ -16,7 +16,11 @@ @@ -16,7 +16,11 @@
#include "windows.h"
#endif
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include <string.h>
#include "crtmemdebug.h"

1
materialsystem/shaderapidx9/shaderapidx8.cpp

@ -42,7 +42,6 @@ mat_fullbright 1 doesn't work properly on alpha materials in testroom_standards @@ -42,7 +42,6 @@ mat_fullbright 1 doesn't work properly on alpha materials in testroom_standards
#include "colorformatdx8.h"
#include "texturedx8.h"
#include "textureheap.h"
#include <malloc.h>
#include "interface.h"
#include "utlrbtree.h"
#include "utlsymbol.h"

1
public/builddisp.cpp

@ -9,7 +9,6 @@ @@ -9,7 +9,6 @@
//#include <stdafx.h>
#include <stdlib.h>
#include <malloc.h>
#include "builddisp.h"
#include "collisionutils.h"
#include "tier1/strtools.h"

2
public/saverestoretypes.h

@ -512,7 +512,7 @@ inline const char *CSaveRestoreSegment::StringFromSymbol( int token ) @@ -512,7 +512,7 @@ inline const char *CSaveRestoreSegment::StringFromSymbol( int token )
/// compilers. Either way, there's no portable intrinsic.
// Newer GCC versions provide this in this header, older did by default.
#if !defined( _rotr ) && defined( COMPILER_GCC ) && !defined( __arm__ )
#if !defined( _rotr ) && defined( COMPILER_GCC ) && !defined( __arm__ ) && !defined( __arm64__ )
#include <x86intrin.h>
#endif

15
public/tier0/memalloc.h

@ -96,8 +96,8 @@ public: @@ -96,8 +96,8 @@ public:
virtual bool IsDebugHeap() = 0;
virtual void GetActualDbgInfo( const char *&pFileName, int &nLine ) = 0;
virtual void RegisterAllocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ) = 0;
virtual void RegisterDeallocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ) = 0;
virtual void RegisterAllocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ) = 0;
virtual void RegisterDeallocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ) = 0;
virtual int GetVersion() = 0;
@ -473,9 +473,14 @@ inline void MemAlloc_CheckAlloc( void *ptr, size_t nSize ) @@ -473,9 +473,14 @@ inline void MemAlloc_CheckAlloc( void *ptr, size_t nSize )
}
#if defined( OSX )
// Mac always aligns allocs, don't need to call posix_memalign which doesn't exist in 10.5.8 which TF2 still needs to run on
//inline void *memalign(size_t alignment, size_t size) {void *pTmp=NULL; posix_memalign(&pTmp, alignment, size); return pTmp;}
inline void *memalign(size_t alignment, size_t size) {void *pTmp=NULL; pTmp = malloc(size); MemAlloc_CheckAlloc( pTmp, size ); return pTmp;}
inline void *memalign(size_t alignment, size_t size) {
// MoeMod : 64bit fix
if(alignment < sizeof(void *))
alignment = sizeof(void *);
void *pTmp = nullptr;
posix_memalign(&pTmp, alignment, size);
return pTmp;
}
#endif
inline void *_aligned_malloc( size_t nSize, size_t align ) { void *ptr = memalign( align, nSize ); MemAlloc_CheckAlloc( ptr, nSize ); return ptr; }

4
public/tier0/memdbgon.h

@ -29,7 +29,11 @@ @@ -29,7 +29,11 @@
#include <wchar.h>
#endif
#include <string.h>
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include "commonmacros.h"
#include "memalloc.h"

2
public/tier1/mempool.h

@ -458,7 +458,7 @@ inline void CAlignedMemPool<ITEM_SIZE, ALIGNMENT, CHUNK_SIZE, CAllocator, COMPAC @@ -458,7 +458,7 @@ inline void CAlignedMemPool<ITEM_SIZE, ALIGNMENT, CHUNK_SIZE, CAllocator, COMPAC
template <int ITEM_SIZE, int ALIGNMENT, int CHUNK_SIZE, class CAllocator, int COMPACT_THRESHOLD >
inline int __cdecl CAlignedMemPool<ITEM_SIZE, ALIGNMENT, CHUNK_SIZE, CAllocator, COMPACT_THRESHOLD>::CompareChunk( void * const *ppLeft, void * const *ppRight )
{
return ((unsigned)*ppLeft) - ((unsigned)*ppRight);
return (int)(((uintp)*ppLeft) - ((uintp)*ppRight));
}
template <int ITEM_SIZE, int ALIGNMENT, int CHUNK_SIZE, class CAllocator, int COMPACT_THRESHOLD >

4
public/vallocator.cpp

@ -8,7 +8,11 @@ @@ -8,7 +8,11 @@
#if !defined(_STATIC_LINKED) || defined(_SHARED_LIB)
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include "vallocator.h"
#include "basetypes.h"

4
public/vstdlib/pch_vstdlib.h

@ -19,7 +19,11 @@ @@ -19,7 +19,11 @@
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include <memory.h>
#include <ctype.h>

1
studiorender/r_studiodraw.cpp

@ -15,7 +15,6 @@ @@ -15,7 +15,6 @@
#include "optimize.h"
#include "mathlib/mathlib.h"
#include "mathlib/vector.h"
#include <malloc.h>
#include "mathlib/vmatrix.h"
#include "studiorendercontext.h"
#include "tier2/tier2.h"

6
tier0/dbg.cpp

@ -17,7 +17,11 @@ @@ -17,7 +17,11 @@
#endif
#include <assert.h>
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
@ -319,7 +323,7 @@ static SpewRetval_t _SpewMessage( SpewType_t spewType, const char *pGroupName, i @@ -319,7 +323,7 @@ static SpewRetval_t _SpewMessage( SpewType_t spewType, const char *pGroupName, i
g_pSpewInfo = &spewInfo;
ret = s_SpewOutputFunc( spewType, pTempBuffer );
g_pSpewInfo = (int)NULL;
g_pSpewInfo = NULL;
switch (ret)
{

4
tier0/mem.cpp

@ -7,7 +7,11 @@ @@ -7,7 +7,11 @@
#include "pch_tier0.h"
#include "tier0/mem.h"
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include "tier0/dbg.h"
#include "tier0/minidump.h"

4
tier0/mem_helpers.cpp

@ -7,7 +7,11 @@ @@ -7,7 +7,11 @@
#include "pch_tier0.h"
#include "mem_helpers.h"
#include <string.h>
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
bool g_bInitMemory = true;

36
tier0/memdbg.cpp

@ -10,7 +10,11 @@ @@ -10,7 +10,11 @@
#if !defined(STEAM) && !defined(NO_MALLOC_OVERRIDE)
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include <string.h>
#include "tier0/dbg.h"
#include "tier0/memalloc.h"
@ -269,7 +273,7 @@ struct DbgMemHeader_t @@ -269,7 +273,7 @@ struct DbgMemHeader_t
: CrtDbgMemHeader_t
#endif
{
unsigned nLogicalSize;
size_t nLogicalSize;
byte reserved[12]; // MS allocator always returns mem aligned on 16 bytes, which some of our code depends on
};
@ -634,11 +638,11 @@ private: @@ -634,11 +638,11 @@ private:
const char *FindOrCreateFilename( const char *pFileName );
// Updates stats
void RegisterAllocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime );
void RegisterDeallocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime );
void RegisterAllocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime );
void RegisterDeallocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime );
void RegisterAllocation( MemInfo_t &info, int nLogicalSize, int nActualSize, unsigned nTime );
void RegisterDeallocation( MemInfo_t &info, int nLogicalSize, int nActualSize, unsigned nTime );
void RegisterAllocation( MemInfo_t &info, size_t nLogicalSize, size_t nActualSize, unsigned nTime );
void RegisterDeallocation( MemInfo_t &info, size_t nLogicalSize, size_t nActualSize, unsigned nTime );
// Gets the allocation file name
const char *GetAllocatonFileName( void *pMem );
@ -1056,21 +1060,21 @@ CDbgMemAlloc::MemInfo_t &CDbgMemAlloc::FindOrCreateEntry( const char *pFileName, @@ -1056,21 +1060,21 @@ CDbgMemAlloc::MemInfo_t &CDbgMemAlloc::FindOrCreateEntry( const char *pFileName,
//-----------------------------------------------------------------------------
// Updates stats
//-----------------------------------------------------------------------------
void CDbgMemAlloc::RegisterAllocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime )
void CDbgMemAlloc::RegisterAllocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime )
{
HEAP_LOCK();
RegisterAllocation( m_GlobalInfo, nLogicalSize, nActualSize, nTime );
RegisterAllocation( FindOrCreateEntry( pFileName, nLine ), nLogicalSize, nActualSize, nTime );
}
void CDbgMemAlloc::RegisterDeallocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime )
void CDbgMemAlloc::RegisterDeallocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime )
{
HEAP_LOCK();
RegisterDeallocation( m_GlobalInfo, nLogicalSize, nActualSize, nTime );
RegisterDeallocation( FindOrCreateEntry( pFileName, nLine ), nLogicalSize, nActualSize, nTime );
}
void CDbgMemAlloc::RegisterAllocation( MemInfo_t &info, int nLogicalSize, int nActualSize, unsigned nTime )
void CDbgMemAlloc::RegisterAllocation( MemInfo_t &info, size_t nLogicalSize, size_t nActualSize, unsigned nTime )
{
++info.m_nCurrentCount;
++info.m_nTotalCount;
@ -1107,7 +1111,7 @@ void CDbgMemAlloc::RegisterAllocation( MemInfo_t &info, int nLogicalSize, int nA @@ -1107,7 +1111,7 @@ void CDbgMemAlloc::RegisterAllocation( MemInfo_t &info, int nLogicalSize, int nA
info.m_nTime += nTime;
}
void CDbgMemAlloc::RegisterDeallocation( MemInfo_t &info, int nLogicalSize, int nActualSize, unsigned nTime )
void CDbgMemAlloc::RegisterDeallocation( MemInfo_t &info, size_t nLogicalSize, size_t nActualSize, unsigned nTime )
{
// Check for decrementing these counters below zero. The checks
// must be done here because these unsigned counters will wrap-around and
@ -1117,7 +1121,7 @@ void CDbgMemAlloc::RegisterDeallocation( MemInfo_t &info, int nLogicalSize, int @@ -1117,7 +1121,7 @@ void CDbgMemAlloc::RegisterDeallocation( MemInfo_t &info, int nLogicalSize, int
// It is technically legal for code to request allocations of zero bytes, and there are a number of places in our code
// that do. So only assert that nLogicalSize >= 0. http://stackoverflow.com/questions/1087042/c-new-int0-will-it-allocate-memory
Assert( nLogicalSize >= 0 );
Assert( info.m_nCurrentSize >= (size_t)nLogicalSize );
Assert( info.m_nCurrentSize >= nLogicalSize );
--info.m_nCurrentCount;
info.m_nCurrentSize -= nLogicalSize;
@ -1250,8 +1254,8 @@ void CDbgMemAlloc::Free( void *pMem, const char * /*pFileName*/, int nLine ) @@ -1250,8 +1254,8 @@ void CDbgMemAlloc::Free( void *pMem, const char * /*pFileName*/, int nLine )
return;
}
int nOldLogicalSize = InternalLogicalSize( pMem );
int nOldSize = InternalMSize( pMem );
size_t nOldLogicalSize = InternalLogicalSize( pMem );
size_t nOldSize = InternalMSize( pMem );
const char *pOldFileName = GetAllocatonFileName( pMem );
int oldLine = GetAllocatonLineNumber( pMem );
@ -1832,6 +1836,10 @@ static inline void unprotect_malloc_zone( malloc_zone_t *malloc_zone ) @@ -1832,6 +1836,10 @@ static inline void unprotect_malloc_zone( malloc_zone_t *malloc_zone )
// The version check may not be necessary, but we know it was RW before that.
if ( malloc_zone->version >= 8 )
{
#ifdef __arm64__
// MoeMod : this is required for Apple Silicon
pthread_jit_write_protect_np(false);
#endif
vm_protect( mach_task_self(), (uintptr_t)malloc_zone, sizeof( malloc_zone_t ), 0, VM_PROT_READ | VM_PROT_WRITE );
}
}
@ -1841,6 +1849,10 @@ static inline void protect_malloc_zone( malloc_zone_t *malloc_zone ) @@ -1841,6 +1849,10 @@ static inline void protect_malloc_zone( malloc_zone_t *malloc_zone )
if ( malloc_zone->version >= 8 )
{
vm_protect( mach_task_self(), (uintptr_t)malloc_zone, sizeof( malloc_zone_t ), 0, VM_PROT_READ );
#ifdef __arm64__
// MoeMod : this is required for Apple Silicon
pthread_jit_write_protect_np(true);
#endif
}
}

4
tier0/memstd.cpp

@ -20,7 +20,11 @@ @@ -20,7 +20,11 @@
#define VA_RESERVE_FLAGS (MEM_RESERVE|MEM_LARGE_PAGES)
#endif
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include "tier0/valve_minmax_off.h" // GCC 4.2.2 headers screw up our min/max defs.
#include <algorithm>

8
tier0/memstd.h

@ -18,7 +18,11 @@ @@ -18,7 +18,11 @@
#endif
#endif
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include <algorithm>
#include "tier0/dbg.h"
#include "tier0/memalloc.h"
@ -253,8 +257,8 @@ public: @@ -253,8 +257,8 @@ public:
virtual bool IsDebugHeap() { return false; }
virtual void GetActualDbgInfo( const char *&pFileName, int &nLine ) {}
virtual void RegisterAllocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ) {}
virtual void RegisterDeallocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ) {}
virtual void RegisterAllocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ) {}
virtual void RegisterDeallocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ) {}
virtual int GetVersion() { return MEMALLOC_VERSION; }

8
tier0/memvalidate.cpp

@ -102,8 +102,8 @@ private: @@ -102,8 +102,8 @@ private:
void GetActualDbgInfo( const char *&pFileName, int &nLine );
// Updates stats
void RegisterAllocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime );
void RegisterDeallocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime );
void RegisterAllocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime );
void RegisterDeallocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime );
HeapSuffix_t *Suffix( HeapPrefix_t *pPrefix );
void *AllocationStart( HeapPrefix_t *pBase );
@ -460,12 +460,12 @@ void CValidateAlloc::GetActualDbgInfo( const char *&pFileName, int &nLine ) @@ -460,12 +460,12 @@ void CValidateAlloc::GetActualDbgInfo( const char *&pFileName, int &nLine )
}
// Updates stats
void CValidateAlloc::RegisterAllocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime )
void CValidateAlloc::RegisterAllocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime )
{
g_pActualAlloc->RegisterAllocation( pFileName, nLine, nLogicalSize, nActualSize, nTime );
}
void CValidateAlloc::RegisterDeallocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime )
void CValidateAlloc::RegisterDeallocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime )
{
g_pActualAlloc->RegisterDeallocation( pFileName, nLine, nLogicalSize, nActualSize, nTime );
}

4
tier0/pch_tier0.h

@ -30,7 +30,11 @@ @@ -30,7 +30,11 @@
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include <memory.h>
#include <ctype.h>
#include <limits.h>

10
tier0/platform_posix.cpp

@ -679,13 +679,17 @@ PLATFORM_INTERFACE void Plat_SetWatchdogHandlerFunction( Plat_WatchDogHandlerFun @@ -679,13 +679,17 @@ PLATFORM_INTERFACE void Plat_SetWatchdogHandlerFunction( Plat_WatchDogHandlerFun
// memory logging this functionality is portable code, except for the way in which it hooks
// malloc/free. glibc contains the ability for the app to install hooks into malloc/free.
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include <tier1/utlintrusivelist.h>
#include <execinfo.h>
#include <tier1/utlvector.h>
#define MEMALLOC_HASHSIZE 8193
typedef uint32 ptrint_t;
typedef uintp ptrint_t;
@ -993,7 +997,7 @@ static inline bool SortLessFunc( CLinuxMallocContext * const &left, CLinuxMalloc @@ -993,7 +997,7 @@ static inline bool SortLessFunc( CLinuxMallocContext * const &left, CLinuxMalloc
void DumpMemoryLog( int nThresh )
{
AUTO_LOCK( s_MemoryMutex );
EndWatchdogTimer();
Plat_EndWatchdogTimer();
RemoveHooks();
std::vector<CLinuxMallocContext *> memList;
@ -1028,7 +1032,7 @@ void DumpMemoryLog( int nThresh ) @@ -1028,7 +1032,7 @@ void DumpMemoryLog( int nThresh )
void DumpChangedMemory( int nThresh )
{
AUTO_LOCK( s_MemoryMutex );
EndWatchdogTimer();
Plat_EndWatchdogTimer();
RemoveHooks();
std::vector<CLinuxMallocContext *> memList;

4
tier1/mempool.cpp

@ -6,7 +6,11 @@ @@ -6,7 +6,11 @@
#include "mempool.h"
#include <stdio.h>
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include <memory.h>
#include "tier0/dbg.h"
#include <ctype.h>

4
vgui2/src/vgui.cpp

@ -26,7 +26,11 @@ @@ -26,7 +26,11 @@
#include <assert.h>
#include <stdio.h>
#include <stdarg.h>
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include <tier0/dbg.h>
#include <tier1/utlhandletable.h>
#include "vgui_internal.h"

4
vgui2/vgui_controls/TextImage.cpp

@ -9,7 +9,11 @@ @@ -9,7 +9,11 @@
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include <vgui/IPanel.h>
#include <vgui/ISurface.h>

4
vgui2/vgui_surfacelib/BitmapFont.cpp

@ -10,7 +10,11 @@ @@ -10,7 +10,11 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include "vgui_surfacelib/BitmapFont.h"
#include "vgui_surfacelib/FontManager.h"
#include <tier0/dbg.h>

4
vgui2/vgui_surfacelib/linuxfont.cpp

@ -12,7 +12,11 @@ @@ -12,7 +12,11 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include <tier0/dbg.h>
#include <vgui/ISurface.h>
#include <utlbuffer.h>

21
vguimatsurface/MatSystemSurface.cpp

@ -48,7 +48,11 @@ ILauncherMgr *g_pLauncherMgr = NULL; @@ -48,7 +48,11 @@ ILauncherMgr *g_pLauncherMgr = NULL;
#include "mathlib/vmatrix.h"
#include <tier0/vprof.h>
#include "materialsystem/itexture.h"
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include "../vgui2/src/VPanel.h"
#include <vgui/IInputInternal.h>
#if defined( _X360 )
@ -142,7 +146,7 @@ CMatSystemSurface g_MatSystemSurface; @@ -142,7 +146,7 @@ CMatSystemSurface g_MatSystemSurface;
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CMatSystemSurface, ISurface,
VGUI_SURFACE_INTERFACE_VERSION, g_MatSystemSurface );
#ifdef LINUX
#if defined(LINUX) || defined(OSX)
CUtlDict< CMatSystemSurface::font_entry, unsigned short > CMatSystemSurface::m_FontData;
#endif
@ -403,7 +407,7 @@ InitReturnVal_t CMatSystemSurface::Init( void ) @@ -403,7 +407,7 @@ InitReturnVal_t CMatSystemSurface::Init( void )
FontManager().SetLanguage( "english" );
}
#ifdef LINUX
#if defined(LINUX) || defined(OSX)
FontManager().SetFontDataHelper( &CMatSystemSurface::FontDataHelper );
#endif
@ -1903,16 +1907,7 @@ bool CMatSystemSurface::AddCustomFontFile( const char *fontName, const char *fon @@ -1903,16 +1907,7 @@ bool CMatSystemSurface::AddCustomFontFile( const char *fontName, const char *fon
}
Assert( success );
return success;
#elif OSX
FSRef ref;
OSStatus err = FSPathMakeRef( (const UInt8*)fullPath, &ref, NULL );
if ( err == noErr )
err = ATSFontActivateFromFileReference( &ref, kATSFontContextLocal, kATSFontFormatUnspecified, NULL, kATSOptionFlagsDefault, NULL );
return err == noErr;
#elif LINUX
#elif defined(LINUX) || defined(OSX)
int size;
if ( CMatSystemSurface::FontDataHelper( fontName, size, fontFileName ) )
@ -1926,7 +1921,7 @@ bool CMatSystemSurface::AddCustomFontFile( const char *fontName, const char *fon @@ -1926,7 +1921,7 @@ bool CMatSystemSurface::AddCustomFontFile( const char *fontName, const char *fon
#endif
}
#ifdef LINUX
#if defined(LINUX) || defined(OSX)
static void RemoveSpaces( CUtlString &str )
{

Loading…
Cancel
Save