use the same allocator everywhere behind pxl8 calls
This commit is contained in:
parent
f18652dc97
commit
fe747969a5
45 changed files with 687 additions and 627 deletions
|
|
@ -5,6 +5,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "pxl8_math.h"
|
||||
#include "pxl8_mem.h"
|
||||
|
||||
static inline u32 hash2d(i32 x, i32 y, u32 seed) {
|
||||
return pxl8_hash32((u32)x ^ ((u32)y * 2654435769u) ^ seed);
|
||||
|
|
@ -168,12 +169,12 @@ static f32 gradient_radial(f32 x, f32 y, f32 cx, f32 cy) {
|
|||
}
|
||||
|
||||
pxl8_graph* pxl8_graph_create(u32 capacity) {
|
||||
pxl8_graph* graph = calloc(1, sizeof(pxl8_graph));
|
||||
pxl8_graph* graph = pxl8_calloc(1, sizeof(pxl8_graph));
|
||||
if (!graph) return NULL;
|
||||
|
||||
graph->nodes = calloc(capacity, sizeof(pxl8_node));
|
||||
graph->nodes = pxl8_calloc(capacity, sizeof(pxl8_node));
|
||||
if (!graph->nodes) {
|
||||
free(graph);
|
||||
pxl8_free(graph);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -186,8 +187,8 @@ pxl8_graph* pxl8_graph_create(u32 capacity) {
|
|||
|
||||
void pxl8_graph_destroy(pxl8_graph* graph) {
|
||||
if (!graph) return;
|
||||
free(graph->nodes);
|
||||
free(graph);
|
||||
pxl8_free(graph->nodes);
|
||||
pxl8_free(graph);
|
||||
}
|
||||
|
||||
void pxl8_graph_clear(pxl8_graph* graph) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue