Fix parantheses on return and sizeof statements.
Used script:
```
import re
import sys
for arg in sys.argv[1:]:
print(arg)
with open(arg, 'r') as file:
content = file.read()
content = re.sub(r"return\s?\((?!.*\).*\()\s*\n?(.*)\n?\);", r"return \1;", \
content, flags = re.M)
content = re.sub(r"sizeof ([^\(][a-zA-Z0-9_\[\]]*)", r"sizeof(\1)",\
content, flags = re.M)
with open(arg, 'w') as file:
file.write(content)
```
Executed with:
` find . -regextype posix-egrep -regex ".*\.([hc]|fmt|function)" | xargs -L1 python script.py`
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
diff --git a/library/timing.c b/library/timing.c
index 8a02c00..0acec5b 100644
--- a/library/timing.c
+++ b/library/timing.c
@@ -84,7 +84,7 @@
if( reset )
{
QueryPerformanceCounter( &t->start );
- return( 0 );
+ return 0 ;
}
else
{
@@ -94,7 +94,7 @@
QueryPerformanceFrequency( &hfreq );
delta = (unsigned long)( ( now.QuadPart - t->start.QuadPart ) * 1000ul
/ hfreq.QuadPart );
- return( delta );
+ return delta ;
}
}
@@ -107,7 +107,7 @@
if( reset )
{
gettimeofday( &t->start, NULL );
- return( 0 );
+ return 0 ;
}
else
{
@@ -116,7 +116,7 @@
gettimeofday( &now, NULL );
delta = ( now.tv_sec - t->start.tv_sec ) * 1000ul
+ ( now.tv_usec - t->start.tv_usec ) / 1000;
- return( delta );
+ return delta ;
}
}
@@ -145,17 +145,17 @@
unsigned long elapsed_ms;
if( ctx->fin_ms == 0 )
- return( -1 );
+ return -1 ;
elapsed_ms = mbedtls_timing_get_timer( &ctx->timer, 0 );
if( elapsed_ms >= ctx->fin_ms )
- return( 2 );
+ return 2 ;
if( elapsed_ms >= ctx->int_ms )
- return( 1 );
+ return 1 ;
- return( 0 );
+ return 0 ;
}
#endif /* !MBEDTLS_TIMING_ALT */