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