blob: b80995654be0c7c29564a5383046ee508ab2b799 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
/*
* Copyright (c) 2023 Marc Pervaz Boocha
*
* SPDX-License-Identifier: MIT
*/
#include <alloc.h>
#include <stdlib.h>
static void* stdcalloc(size_t size){
return calloc(1, size);
}
static void* stdmalloc(size_t size){
return malloc(size);
}
static void* stdrealloc(void* ptr, size_t size){
return realloc(ptr, size);
}
static void stdfree(void* ptr){
free(ptr);
}
static struct calt_alloc alloc = {
.malloc = stdmalloc, .realloc = stdrealloc, .free = stdfree, .calloc = stdcalloc};
void calt_use_custom_alloc(struct calt_alloc allocator) { alloc = allocator; }
struct calt_alloc calt_get_alloc(void) { return alloc; }
|