mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
Fixed memory allocation
This commit is contained in:
parent
f2faf990a0
commit
ac59f75523
@ -2689,8 +2689,6 @@ void ValidateMacros_DontCallThis_Smiley()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MEMORY_TEST
|
|
||||||
|
|
||||||
/************* MEMORY *************/
|
/************* MEMORY *************/
|
||||||
// undef all defined macros
|
// undef all defined macros
|
||||||
#undef new
|
#undef new
|
||||||
@ -2804,7 +2802,7 @@ void *operator new(size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *operator new[](size_t reportedSize)
|
void *operator new[](size_t reportedSize)
|
||||||
@ -2817,7 +2815,7 @@ void *operator new[](size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Microsoft memory tracking operators
|
// Microsoft memory tracking operators
|
||||||
@ -2831,7 +2829,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
|
||||||
}
|
}
|
||||||
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
||||||
{
|
{
|
||||||
@ -2843,7 +2841,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete(void *reportedAddress)
|
void operator delete(void *reportedAddress)
|
||||||
@ -2862,8 +2860,6 @@ void operator delete[](void *reportedAddress)
|
|||||||
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
|
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************* stuff from dlls/util.cpp *************/
|
/************* stuff from dlls/util.cpp *************/
|
||||||
// must come here because cbase.h declares it's own operator new
|
// must come here because cbase.h declares it's own operator new
|
||||||
|
|
||||||
|
@ -2122,8 +2122,6 @@ void MF_Log(const char *fmt, ...);
|
|||||||
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
|
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
|
||||||
#define MF_GetPlayerFlags g_fn_GetPlayerFlags
|
#define MF_GetPlayerFlags g_fn_GetPlayerFlags
|
||||||
|
|
||||||
#ifdef MEMORY_TEST
|
|
||||||
|
|
||||||
/*** Memory ***/
|
/*** Memory ***/
|
||||||
void *operator new(size_t reportedSize);
|
void *operator new(size_t reportedSize);
|
||||||
void *operator new[](size_t reportedSize);
|
void *operator new[](size_t reportedSize);
|
||||||
@ -2167,6 +2165,4 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons
|
|||||||
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
|
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
|
||||||
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
||||||
|
|
||||||
#endif //MEMORY_TEST
|
|
||||||
|
|
||||||
#endif // #ifndef __AMXXMODULE_H__
|
#endif // #ifndef __AMXXMODULE_H__
|
||||||
|
Loading…
Reference in New Issue
Block a user