Migrated the Memory layer to the Platform layer

Deprecated POLARSSL_MEMORY_C and placed placeholder for memory.h to make
sure current code will not break on new version.
This commit is contained in:
Paul Bakker 2014-02-04 17:30:24 +01:00
parent b2f66c9158
commit defc0ca337
9 changed files with 199 additions and 183 deletions

View file

@ -29,6 +29,38 @@
#include "polarssl/platform.h"
#if defined(POLARSSL_PLATFORM_MEMORY)
#if !defined(POLARSSL_PLATFORM_STD_MALLOC)
static void *platform_malloc_uninit( size_t len )
{
((void) len);
return( NULL );
}
#define POLARSSL_PLATFORM_STD_MALLOC memory_malloc_uninit
#endif /* !POLARSSL_PLATFORM_STD_MALLOC */
#if !defined(POLARSSL_PLATFORM_STD_FREE)
static void platform_free_uninit( void *ptr )
{
((void) ptr);
}
#define POLARSSL_PLATFORM_STD_FREE memory_free_uninit
#endif /* !POLARSSL_PLATFORM_STD_FREE */
void * (*polarssl_malloc)( size_t ) = POLARSSL_PLATFORM_STD_MALLOC;
void (*polarssl_free)( void * ) = POLARSSL_PLATFORM_STD_FREE;
int platform_set_malloc_free( void * (*malloc_func)( size_t ),
void (*free_func)( void * ) )
{
polarssl_malloc = malloc_func;
polarssl_free = free_func;
return( 0 );
}
#endif /* POLARSSL_PLATFORM_MEMORY */
#if defined(POLARSSL_PLATFORM_PRINTF_ALT)
#if !defined(POLARSSL_PLATFORM_STD_PRINTF)
/*