mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 01:04:02 +02:00
Remove the Windows-specific default memcpy(), malloc(), etc.
This commit is contained in:
@@ -14,6 +14,7 @@ v0.11.12 - TBD
|
||||
* Optimizations to the high level API.
|
||||
* Remove the old runtime linking system for pthread. The `MA_USE_RUNTIME_LINKING_FOR_PTHREAD` option is no longer used.
|
||||
* WASAPI: Fix a crash when starting a device while it's in the process of rerouting.
|
||||
* Windows: Remove the Windows-specific default memcpy(), malloc(), etc.
|
||||
|
||||
|
||||
v0.11.11 - 2022-11-04
|
||||
|
||||
+1
-32
@@ -12149,36 +12149,18 @@ 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))
|
||||
#else
|
||||
#define MA_MALLOC(sz) malloc((sz))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MA_REALLOC
|
||||
#ifdef MA_WIN32
|
||||
#define MA_REALLOC(p, sz) (((sz) > 0) ? ((p) ? HeapReAlloc(GetProcessHeap(), 0, (p), (sz)) : HeapAlloc(GetProcessHeap(), 0, (sz))) : ((void*)(size_t)(HeapFree(GetProcessHeap(), 0, (p)) & 0)))
|
||||
#else
|
||||
#define MA_REALLOC(p, sz) realloc((p), (sz))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MA_FREE
|
||||
#ifdef MA_WIN32
|
||||
#define MA_FREE(p) HeapFree(GetProcessHeap(), 0, (p))
|
||||
#else
|
||||
#define MA_FREE(p) free((p))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static MA_INLINE void ma_zero_memory_default(void* p, size_t sz)
|
||||
{
|
||||
@@ -12187,34 +12169,21 @@ static MA_INLINE void ma_zero_memory_default(void* p, size_t sz)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MA_WIN32
|
||||
ZeroMemory(p, sz);
|
||||
#else
|
||||
if (sz > 0) {
|
||||
memset(p, 0, sz);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifndef MA_ZERO_MEMORY
|
||||
#define MA_ZERO_MEMORY(p, sz) ma_zero_memory_default((p), (sz))
|
||||
#endif
|
||||
|
||||
#ifndef MA_COPY_MEMORY
|
||||
#ifdef MA_WIN32
|
||||
#define MA_COPY_MEMORY(dst, src, sz) CopyMemory((dst), (src), (sz))
|
||||
#else
|
||||
#define MA_COPY_MEMORY(dst, src, sz) memcpy((dst), (src), (sz))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MA_MOVE_MEMORY
|
||||
#ifdef MA_WIN32
|
||||
#define MA_MOVE_MEMORY(dst, src, sz) MoveMemory((dst), (src), (sz))
|
||||
#else
|
||||
#define MA_MOVE_MEMORY(dst, src, sz) memmove((dst), (src), (sz))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define MA_ZERO_OBJECT(p) MA_ZERO_MEMORY((p), sizeof(*(p)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user