mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-21 15:56:58 +02:00
Add an assert to ma_zero_memory_default().
This commit is contained in:
+13
-8
@@ -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]))
|
||||
|
||||
Reference in New Issue
Block a user