mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +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
|
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
|
#ifndef MA_MALLOC
|
||||||
#ifdef MA_WIN32
|
#ifdef MA_WIN32
|
||||||
#define MA_MALLOC(sz) HeapAlloc(GetProcessHeap(), 0, (sz))
|
#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)
|
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
|
#ifdef MA_WIN32
|
||||||
ZeroMemory(p, sz);
|
ZeroMemory(p, sz);
|
||||||
#else
|
#else
|
||||||
@@ -11995,14 +12008,6 @@ static MA_INLINE void ma_zero_memory_default(void* p, size_t sz)
|
|||||||
#endif
|
#endif
|
||||||
#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_ZERO_OBJECT(p) MA_ZERO_MEMORY((p), sizeof(*(p)))
|
||||||
|
|
||||||
#define ma_countof(x) (sizeof(x) / sizeof(x[0]))
|
#define ma_countof(x) (sizeof(x) / sizeof(x[0]))
|
||||||
|
|||||||
Reference in New Issue
Block a user