mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-07 06:42:56 +03:00
Return from the test and utility examples via exit()
All the core examples have been modified not to return from main by the means of the return statement, but rather via exit() function, which was done to make the examples more bare metal friendly. This commit, for the sake of consistency, introduces the modifications to the test and utility examples. These, while less likely to be used in the low level environments, won't suffer from such a change.
This commit is contained in:
@@ -29,7 +29,9 @@
|
||||
#include "mbedtls/platform.h"
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define mbedtls_printf printf
|
||||
#define mbedtls_exit exit
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY)
|
||||
@@ -48,7 +50,7 @@
|
||||
int main( void )
|
||||
{
|
||||
mbedtls_printf("MBEDTLS_ERROR_C and/or MBEDTLS_ERROR_STRERROR_DUMMY not defined.\n");
|
||||
return( 0 );
|
||||
mbedtls_exit( 0 );
|
||||
}
|
||||
#else
|
||||
int main( int argc, char *argv[] )
|
||||
@@ -59,7 +61,7 @@ int main( int argc, char *argv[] )
|
||||
if( argc != 2 )
|
||||
{
|
||||
mbedtls_printf( USAGE );
|
||||
return( 0 );
|
||||
mbedtls_exit( 0 );
|
||||
}
|
||||
|
||||
val = strtol( argv[1], &end, 10 );
|
||||
@@ -87,6 +89,6 @@ int main( int argc, char *argv[] )
|
||||
fflush( stdout ); getchar();
|
||||
#endif
|
||||
|
||||
return( val );
|
||||
mbedtls_exit( val );
|
||||
}
|
||||
#endif /* MBEDTLS_ERROR_C */
|
||||
|
Reference in New Issue
Block a user