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

This commit is contained in:
hymei
2022-06-05 01:12:37 +03:00
committed by nillerusr
parent 4e4039d756
commit ff588a8810
40 changed files with 152 additions and 52 deletions
-1
View File
@@ -9,7 +9,6 @@
//#include <stdafx.h>
#include <stdlib.h>
#include <malloc.h>
#include "builddisp.h"
#include "collisionutils.h"
#include "tier1/strtools.h"
+1 -1
View File
@@ -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
+10 -5
View File
@@ -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 )
}
#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
View File
@@ -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"
+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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>