jemalloc/include/jemalloc/internal/test_hooks.h
Slobodan Predolac c944cad7b1 Break two include cycles
- test_hooks.h: drop the #include of jemalloc_preamble.h.  preamble
  pulls test_hooks.h, and test_hooks.h needs nothing from preamble.

- edata.h: drop the #include of prof_types.h in favor of forward
  declarations of prof_tctx_t and prof_recent_t (used only as pointer
  types).  prof_structs.h can then drop its #include of edata.h,
  severing the edata <-> prof_types coupling.
2026-06-04 11:32:53 -04:00

27 lines
1.2 KiB
C

#ifndef JEMALLOC_INTERNAL_TEST_HOOKS_H
#define JEMALLOC_INTERNAL_TEST_HOOKS_H
extern JEMALLOC_EXPORT void (*test_hooks_arena_new_hook)(void);
extern JEMALLOC_EXPORT void (*test_hooks_libc_hook)(void);
extern JEMALLOC_EXPORT void (*test_hooks_safety_check_abort)(const char *);
#if defined(JEMALLOC_JET) || defined(JEMALLOC_UNIT_TEST)
# define JEMALLOC_TEST_HOOK(fn, hook) \
((void)(hook != NULL && (hook(), 0)), fn)
# define open JEMALLOC_TEST_HOOK(open, test_hooks_libc_hook)
# define read JEMALLOC_TEST_HOOK(read, test_hooks_libc_hook)
# define write JEMALLOC_TEST_HOOK(write, test_hooks_libc_hook)
# define readlink JEMALLOC_TEST_HOOK(readlink, test_hooks_libc_hook)
# define close JEMALLOC_TEST_HOOK(close, test_hooks_libc_hook)
# define creat JEMALLOC_TEST_HOOK(creat, test_hooks_libc_hook)
# define secure_getenv \
JEMALLOC_TEST_HOOK(secure_getenv, test_hooks_libc_hook)
/* Note that this is undef'd and re-define'd in src/prof.c. */
# define _Unwind_Backtrace \
JEMALLOC_TEST_HOOK(_Unwind_Backtrace, test_hooks_libc_hook)
#else
# define JEMALLOC_TEST_HOOK(fn, hook) fn
#endif
#endif /* JEMALLOC_INTERNAL_TEST_HOOKS_H */