| 1 |
/* |
| 2 |
* Memory allocation functions for testing |
| 3 |
* |
| 4 |
* Copyright (C) 2012-2025, Joachim Metz <[email protected]> |
| 5 |
* |
| 6 |
* Refer to AUTHORS for acknowledgements. |
| 7 |
* |
| 8 |
* This program is free software: you can redistribute it and/or modify |
| 9 |
* it under the terms of the GNU Lesser General Public License as published by |
| 10 |
* the Free Software Foundation, either version 3 of the License, or |
| 11 |
* (at your option) any later version. |
| 12 |
* |
| 13 |
* This program is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU Lesser General Public License |
| 19 |
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 20 |
*/ |
| 21 |
|
| 22 |
#if !defined( _VHDI_TEST_MEMORY_H ) |
| 23 |
#define _VHDI_TEST_MEMORY_H |
| 24 |
|
| 25 |
#include <common.h> |
| 26 |
|
| 27 |
#if defined( __cplusplus ) |
| 28 |
extern "C" { |
| 29 |
#endif |
| 30 |
|
| 31 |
#if defined( HAVE_GNU_DL_DLSYM ) && defined( __GNUC__ ) && !defined( LIBVHDI_DLL_IMPORT ) && !defined( __arm__ ) && !defined( __clang__ ) && !defined( __CYGWIN__ ) && !defined( __hppa__ ) && !defined( __loongarch__ ) && !defined( __mips__ ) && !defined( __riscv ) && !defined( __sparc__ ) && !defined( HAVE_ASAN ) |
| 32 |
#define HAVE_VHDI_TEST_MEMORY 1 |
| 33 |
#endif |
| 34 |
|
| 35 |
#if defined( HAVE_VHDI_TEST_MEMORY ) |
| 36 |
|
| 37 |
extern int vhdi_test_malloc_attempts_before_fail; |
| 38 |
|
| 39 |
extern int vhdi_test_memcpy_attempts_before_fail; |
| 40 |
|
| 41 |
extern int vhdi_test_memset_attempts_before_fail; |
| 42 |
|
| 43 |
extern int vhdi_test_realloc_attempts_before_fail; |
| 44 |
|
| 45 |
#endif /* defined( HAVE_VHDI_TEST_MEMORY ) */ |
| 46 |
|
| 47 |
#if defined( __cplusplus ) |
| 48 |
} |
| 49 |
#endif |
| 50 |
|
| 51 |
#endif /* !defined( _VHDI_TEST_MEMORY_H ) */ |
| 52 |
|