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