mirror of
https://github.com/thunderbrewhq/squall.git
synced 2026-02-04 00:49:08 +00:00
chore(memory): add additional tests and flag
This commit is contained in:
parent
2e044682e1
commit
8e9fb741b6
3 changed files with 83 additions and 5 deletions
|
|
@ -7,7 +7,7 @@ void* SMemAlloc(size_t bytes, const char* filename, int32_t linenumber, uint32_t
|
|||
|
||||
void* result;
|
||||
|
||||
if (flags & 0x8) {
|
||||
if (flags & SMEM_FLAG_ZEROMEMORY) {
|
||||
result = calloc(1, alignedBytes);
|
||||
} else {
|
||||
result = malloc(alignedBytes);
|
||||
|
|
|
|||
|
|
@ -4,12 +4,16 @@
|
|||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
|
||||
void* SMemAlloc(size_t bytes, const char* filename, int32_t linenumber, uint32_t flags);
|
||||
|
||||
#define SMEM_FLAG_ZEROMEMORY 8
|
||||
|
||||
|
||||
void* SMemAlloc(size_t bytes, const char* filename, int32_t linenumber, uint32_t flags = 0);
|
||||
|
||||
void SMemFree(void* ptr);
|
||||
|
||||
void SMemFree(void* ptr, const char* filename, int32_t linenumber, uint32_t flags);
|
||||
void SMemFree(void* ptr, const char* filename, int32_t linenumber, uint32_t flags = 0);
|
||||
|
||||
void* SMemReAlloc(void* ptr, size_t bytes, const char* filename, int32_t linenumber, uint32_t flags);
|
||||
void* SMemReAlloc(void* ptr, size_t bytes, const char* filename, int32_t linenumber, uint32_t flags = 0);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue