mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-10-16 13:57:23 +00:00
Switch to the new code style
Signed-off-by: Gilles Peskine <[email protected]>
This commit is contained in:
+22
-23
@@ -41,7 +41,7 @@ static int trace_depth = 0;
|
||||
#define color_cyan "\x1B[1;36m"
|
||||
#define color_white "\x1B[1;37m"
|
||||
|
||||
static char const * colors[] =
|
||||
static char const *colors[] =
|
||||
{
|
||||
color_default,
|
||||
color_green,
|
||||
@@ -54,19 +54,18 @@ static char const * colors[] =
|
||||
|
||||
#define MPS_TRACE_BUF_SIZE 100
|
||||
|
||||
void mbedtls_mps_trace_print_msg( int id, int line, const char *format, ... )
|
||||
void mbedtls_mps_trace_print_msg(int id, int line, const char *format, ...)
|
||||
{
|
||||
int ret;
|
||||
char str[MPS_TRACE_BUF_SIZE];
|
||||
va_list argp;
|
||||
va_start( argp, format );
|
||||
ret = mbedtls_vsnprintf( str, MPS_TRACE_BUF_SIZE, format, argp );
|
||||
va_end( argp );
|
||||
va_start(argp, format);
|
||||
ret = mbedtls_vsnprintf(str, MPS_TRACE_BUF_SIZE, format, argp);
|
||||
va_end(argp);
|
||||
|
||||
if( ret >= 0 && ret < MPS_TRACE_BUF_SIZE )
|
||||
{
|
||||
if (ret >= 0 && ret < MPS_TRACE_BUF_SIZE) {
|
||||
str[ret] = '\0';
|
||||
mbedtls_printf( "[%d|L%d]: %s\n", id, line, str );
|
||||
mbedtls_printf("[%d|L%d]: %s\n", id, line, str);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,39 +82,39 @@ void mbedtls_mps_trace_inc_depth()
|
||||
trace_depth++;
|
||||
}
|
||||
|
||||
void mbedtls_mps_trace_color( int id )
|
||||
void mbedtls_mps_trace_color(int id)
|
||||
{
|
||||
if( id > (int) ( sizeof( colors ) / sizeof( *colors ) ) )
|
||||
if (id > (int) (sizeof(colors) / sizeof(*colors))) {
|
||||
return;
|
||||
printf( "%s", colors[ id ] );
|
||||
}
|
||||
printf("%s", colors[id]);
|
||||
}
|
||||
|
||||
void mbedtls_mps_trace_indent( int level, mbedtls_mps_trace_type ty )
|
||||
void mbedtls_mps_trace_indent(int level, mbedtls_mps_trace_type ty)
|
||||
{
|
||||
if( level > 0 )
|
||||
{
|
||||
while( --level )
|
||||
printf( "| " );
|
||||
if (level > 0) {
|
||||
while (--level) {
|
||||
printf("| ");
|
||||
}
|
||||
|
||||
printf( "| " );
|
||||
printf("| ");
|
||||
}
|
||||
|
||||
switch( ty )
|
||||
{
|
||||
switch (ty) {
|
||||
case MBEDTLS_MPS_TRACE_TYPE_COMMENT:
|
||||
mbedtls_printf( "@ " );
|
||||
mbedtls_printf("@ ");
|
||||
break;
|
||||
|
||||
case MBEDTLS_MPS_TRACE_TYPE_CALL:
|
||||
mbedtls_printf( "+--> " );
|
||||
mbedtls_printf("+--> ");
|
||||
break;
|
||||
|
||||
case MBEDTLS_MPS_TRACE_TYPE_ERROR:
|
||||
mbedtls_printf( "E " );
|
||||
mbedtls_printf("E ");
|
||||
break;
|
||||
|
||||
case MBEDTLS_MPS_TRACE_TYPE_RETURN:
|
||||
mbedtls_printf( "< " );
|
||||
mbedtls_printf("< ");
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user