xref: /freebsd/contrib/libcbor/src/allocators.c (revision 10ff414c14eef433d8157f0c17904d740693933b)
1*10ff414cSEd Maste /*
2*10ff414cSEd Maste  * Copyright (c) 2014-2020 Pavel Kalvoda <me@pavelkalvoda.com>
3*10ff414cSEd Maste  *
4*10ff414cSEd Maste  * libcbor is free software; you can redistribute it and/or modify
5*10ff414cSEd Maste  * it under the terms of the MIT license. See LICENSE for details.
6*10ff414cSEd Maste  */
7*10ff414cSEd Maste 
8*10ff414cSEd Maste #include "cbor/common.h"
9*10ff414cSEd Maste 
10*10ff414cSEd Maste CBOR_EXPORT _cbor_malloc_t _cbor_malloc = malloc;
11*10ff414cSEd Maste CBOR_EXPORT _cbor_realloc_t _cbor_realloc = realloc;
12*10ff414cSEd Maste CBOR_EXPORT _cbor_free_t _cbor_free = free;
13*10ff414cSEd Maste 
cbor_set_allocs(_cbor_malloc_t custom_malloc,_cbor_realloc_t custom_realloc,_cbor_free_t custom_free)14*10ff414cSEd Maste void cbor_set_allocs(_cbor_malloc_t custom_malloc,
15*10ff414cSEd Maste                      _cbor_realloc_t custom_realloc, _cbor_free_t custom_free) {
16*10ff414cSEd Maste   _cbor_malloc = custom_malloc;
17*10ff414cSEd Maste   _cbor_realloc = custom_realloc;
18*10ff414cSEd Maste   _cbor_free = custom_free;
19*10ff414cSEd Maste }
20