Apply clang formatting.
Executed with:
`find . -regextype posix-egrep -regex ".*\.([hc]|fmt|function)" | xargs -L1 clang-format-12 -i`
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
diff --git a/library/mps_trace.c b/library/mps_trace.c
index 6026a07..af20b91 100644
--- a/library/mps_trace.c
+++ b/library/mps_trace.c
@@ -23,50 +23,42 @@
#if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL)
-#include "mps_common.h"
+# include "mps_common.h"
-#if defined(MBEDTLS_MPS_ENABLE_TRACE)
+# if defined(MBEDTLS_MPS_ENABLE_TRACE)
-#include "mps_trace.h"
-#include <stdarg.h>
+# include "mps_trace.h"
+# include <stdarg.h>
static int trace_depth = 0;
-#define color_default "\x1B[0m"
-#define color_red "\x1B[1;31m"
-#define color_green "\x1B[1;32m"
-#define color_yellow "\x1B[1;33m"
-#define color_blue "\x1B[1;34m"
-#define color_magenta "\x1B[1;35m"
-#define color_cyan "\x1B[1;36m"
-#define color_white "\x1B[1;37m"
+# define color_default "\x1B[0m"
+# define color_red "\x1B[1;31m"
+# define color_green "\x1B[1;32m"
+# define color_yellow "\x1B[1;33m"
+# define color_blue "\x1B[1;34m"
+# define color_magenta "\x1B[1;35m"
+# define color_cyan "\x1B[1;36m"
+# define color_white "\x1B[1;37m"
-static char const * colors[] =
-{
- color_default,
- color_green,
- color_yellow,
- color_magenta,
- color_cyan,
- color_blue,
- color_white
-};
+static char const *colors[] = { color_default, color_green, color_yellow,
+ color_magenta, color_cyan, color_blue,
+ color_white };
-#define MPS_TRACE_BUF_SIZE 100
+# 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 +75,37 @@
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:
@@ -123,5 +113,5 @@
}
}
-#endif /* MBEDTLS_MPS_ENABLE_TRACE */
+# endif /* MBEDTLS_MPS_ENABLE_TRACE */
#endif /* MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */