# endif
#endif
+/*
+ * Build-time hook for white-box testing of memory allocation behaviour.
+ */
+#if TEST_MALLOC_HOOK
+void *test_realloc_hook(void *, size_t);
+
+static inline void *test_wrap_malloc(size_t n)
+{
+ return test_realloc_hook(0, n);
+}
+
+static inline void test_wrap_free(void *p)
+{
+ test_realloc_hook(p, 0);
+}
+
+#undef realloc
+#define realloc test_realloc_hook
+#undef malloc
+#define malloc test_wrap_malloc
+#undef free
+#define free test_wrap_free
+#endif
+
#endif