1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-28 18:54:27 +01:00

Fixes #116: Allow overrides of the Unity Fixture's memory functions. This enables custom heap implementations to be used with the Unity Fixture.

This commit is contained in:
Andrew Burks
2015-06-30 15:32:57 -07:00
parent 31b1255663
commit 7737fee444
2 changed files with 24 additions and 2 deletions

View File

@@ -10,6 +10,28 @@
#include <stddef.h>
// This function is used by the Unity Fixture to allocate memory on
// the heap and can be overridden with platform-specific heap
// implementations. For example, when using FreeRTOS
// UNITY_FIXTURE_MALLOC becomes pvPortMalloc().
#ifndef UNITY_FIXTURE_MALLOC
#define UNITY_FIXTURE_MALLOC( SIZE ) malloc( ( SIZE ) )
#else
extern void * UNITY_FIXTURE_MALLOC(size_t size);
#endif
// This function is used by the Unity Fixture to release memory in the
// heap and can be overridden with platform-specific heap
// implementations. For example, when using FreeRTOS
// UNITY_FIXTURE_FREE becomes vPortFree().
#ifndef UNITY_FIXTURE_FREE
#define UNITY_FIXTURE_FREE( PTR ) free( ( PTR ) )
#else
extern void UNITY_FIXTURE_FREE(void *ptr);
#endif
#define malloc unity_malloc
#define calloc unity_calloc
#define realloc unity_realloc