mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 15:58:12 +00:00
Merge remote-tracking branch 'public/pr/1681' into development
This commit is contained in:
commit
1f91575546
2 changed files with 16 additions and 6 deletions
|
@ -121,8 +121,8 @@ extern "C" {
|
|||
#else
|
||||
/* For size_t */
|
||||
#include <stddef.h>
|
||||
extern void * (*mbedtls_calloc)( size_t n, size_t size );
|
||||
extern void (*mbedtls_free)( void *ptr );
|
||||
extern void *mbedtls_calloc( size_t n, size_t size );
|
||||
extern void mbedtls_free( void *ptr );
|
||||
|
||||
/**
|
||||
* \brief This function dynamically sets the memory-management
|
||||
|
|
|
@ -51,14 +51,24 @@ static void platform_free_uninit( void *ptr )
|
|||
#define MBEDTLS_PLATFORM_STD_FREE platform_free_uninit
|
||||
#endif /* !MBEDTLS_PLATFORM_STD_FREE */
|
||||
|
||||
void * (*mbedtls_calloc)( size_t, size_t ) = MBEDTLS_PLATFORM_STD_CALLOC;
|
||||
void (*mbedtls_free)( void * ) = MBEDTLS_PLATFORM_STD_FREE;
|
||||
static void * (*mbedtls_calloc_func)( size_t, size_t ) = MBEDTLS_PLATFORM_STD_CALLOC;
|
||||
static void (*mbedtls_free_func)( void * ) = MBEDTLS_PLATFORM_STD_FREE;
|
||||
|
||||
void * mbedtls_calloc( size_t nmemb, size_t size )
|
||||
{
|
||||
return (*mbedtls_calloc_func)( nmemb, size );
|
||||
}
|
||||
|
||||
void mbedtls_free( void * ptr )
|
||||
{
|
||||
(*mbedtls_free_func)( ptr );
|
||||
}
|
||||
|
||||
int mbedtls_platform_set_calloc_free( void * (*calloc_func)( size_t, size_t ),
|
||||
void (*free_func)( void * ) )
|
||||
{
|
||||
mbedtls_calloc = calloc_func;
|
||||
mbedtls_free = free_func;
|
||||
mbedtls_calloc_func = calloc_func;
|
||||
mbedtls_free_func = free_func;
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* MBEDTLS_PLATFORM_MEMORY */
|
||||
|
|
Loading…
Reference in a new issue