Basicallly POC, but still somethign wrong with u_FontQuadParts
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "dawnlibs.hpp"
|
||||
#include "assert/assert.hpp"
|
||||
|
||||
/**
|
||||
* Allocate some space in memory to use for your needs. Memory allocation may
|
||||
@ -17,7 +17,10 @@
|
||||
* @return Pointer to the space in memory to use.
|
||||
*/
|
||||
static inline void * memoryAllocate(const size_t size) {
|
||||
return (void *)malloc(size);
|
||||
assertTrue(size > 0);
|
||||
auto x = (void *)malloc(size);
|
||||
assertNotNull(x);
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -27,7 +30,10 @@ static inline void * memoryAllocate(const size_t size) {
|
||||
* @return Pointer to the space in memory to use.
|
||||
*/
|
||||
static inline void * memoryFillWithZero(const size_t size) {
|
||||
return (void *)calloc(1, size);
|
||||
assertTrue(size > 0);
|
||||
auto x =(void *)calloc(1, size);
|
||||
assertNotNull(x);
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
@ -52,6 +58,10 @@ static inline void memoryCopy(
|
||||
void *destination,
|
||||
size_t size
|
||||
) {
|
||||
assertNotNull(source);
|
||||
assertNotNull(destination);
|
||||
assertTrue(destination != source);
|
||||
assertTrue(size > 0);
|
||||
memcpy(destination, source, size);
|
||||
}
|
||||
|
||||
@ -68,6 +78,8 @@ static inline int32_t memoryCompare(
|
||||
const void *right,
|
||||
const size_t size
|
||||
) {
|
||||
assertTrue(left != right);
|
||||
assertTrue(size > 0);
|
||||
return memcmp(left, right, size);
|
||||
}
|
||||
|
||||
@ -83,6 +95,8 @@ static inline void memorySet(
|
||||
uint8_t data,
|
||||
size_t length
|
||||
) {
|
||||
assertNotNull(dest);
|
||||
assertTrue(length > 0);
|
||||
memset(dest, data, length);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user