Commit 593897f1 authored by David Reid's avatar David Reid

Add an assert to ma_zero_memory_default().

parent d16e6e4d
......@@ -11940,6 +11940,14 @@ MA_API const char* ma_version_string(void)
Standard Library Stuff
******************************************************************************/
#ifndef MA_ASSERT
#ifdef MA_WIN32
#define MA_ASSERT(condition) assert(condition)
#else
#define MA_ASSERT(condition) assert(condition)
#endif
#endif
#ifndef MA_MALLOC
#ifdef MA_WIN32
#define MA_MALLOC(sz) HeapAlloc(GetProcessHeap(), 0, (sz))
......@@ -11966,6 +11974,11 @@ Standard Library Stuff
static MA_INLINE void ma_zero_memory_default(void* p, size_t sz)
{
if (p == NULL) {
MA_ASSERT(sz == 0); /* If this is triggered there's an error with the calling code. */
return;
}
#ifdef MA_WIN32
ZeroMemory(p, sz);
#else
......@@ -11995,14 +12008,6 @@ static MA_INLINE void ma_zero_memory_default(void* p, size_t sz)
#endif
#endif
#ifndef MA_ASSERT
#ifdef MA_WIN32
#define MA_ASSERT(condition) assert(condition)
#else
#define MA_ASSERT(condition) assert(condition)
#endif
#endif
#define MA_ZERO_OBJECT(p) MA_ZERO_MEMORY((p), sizeof(*(p)))
#define ma_countof(x) (sizeof(x) / sizeof(x[0]))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment