Basicallly POC, but still somethign wrong with u_FontQuadParts

This commit is contained in:
2023-06-04 10:05:42 -07:00
parent 6a61255aee
commit bbd442b191
7 changed files with 45 additions and 21 deletions

View File

@ -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);
}