/src/open62541/tests/fuzz/fuzz_arch.h
Line | Count | Source |
1 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
2 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
4 | | * |
5 | | * Copyright 2026 (c) o6 Automation GmbH (Author: Julius Pfrommer) |
6 | | */ |
7 | | |
8 | | #include <stddef.h> |
9 | | |
10 | | /* The following uses __thread, which is available for clang. |
11 | | * No other compilers are currently used for fuzzing. */ |
12 | | extern __thread void * (*UA_mallocSingleton)(size_t size); |
13 | | extern __thread void (*UA_freeSingleton)(void *ptr); |
14 | | extern __thread void * (*UA_callocSingleton)(size_t nelem, size_t elsize); |
15 | | extern __thread void * (*UA_reallocSingleton)(void *ptr, size_t size); |
16 | | |
17 | | /* Define these and prevent the use of defaults in the open62541/config.h. */ |
18 | 304 | #define UA_malloc(size) UA_mallocSingleton(size) |
19 | 85.2k | #define UA_free(ptr) UA_freeSingleton(ptr) |
20 | 5.87k | #define UA_calloc(num, size) UA_callocSingleton(num, size) |
21 | 236k | #define UA_realloc(ptr, size) UA_reallocSingleton(ptr, size) |