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

Remove atoi() dependency, only need stdlib.h in Fixture for malloc

For redefinition of UNITY_FIXTURE_MALLOC/...FREE use both or replace both.
 Clean up whitespace, remaining void*, and comment.
This commit is contained in:
jsalling
2016-01-30 22:35:59 -06:00
parent 34a30f8e98
commit 63a0b98faf
2 changed files with 20 additions and 33 deletions

View File

@@ -10,26 +10,17 @@
#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().
// These functions are used by the Unity Fixture to allocate and release memory
// on the heap and can be overridden with platform-specific implementations.
// For example, when using FreeRTOS UNITY_FIXTURE_MALLOC becomes pvPortMalloc()
// and UNITY_FIXTURE_FREE becomes vPortFree().
#ifndef UNITY_FIXTURE_MALLOC
#define UNITY_FIXTURE_MALLOC( SIZE ) malloc( ( SIZE ) )
#if !defined(UNITY_FIXTURE_MALLOC) || !defined(UNITY_FIXTURE_FREE)
#define UNITY_FIXTURE_MALLOC(size) malloc(size)
#define UNITY_FIXTURE_FREE(ptr) free(ptr)
#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);
extern void* UNITY_FIXTURE_MALLOC(size_t size);
extern void UNITY_FIXTURE_FREE(void* ptr);
#endif
#define malloc unity_malloc