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/tests/suites/test_suite_entropy.function b/tests/suites/test_suite_entropy.function
index c26f4f8..6f72add 100644
--- a/tests/suites/test_suite_entropy.function
+++ b/tests/suites/test_suite_entropy.function
@@ -39,11 +39,11 @@
*olen = len;
break;
case DUMMY_FAIL:
- return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
+ return MBEDTLS_ERR_ENTROPY_SOURCE_FAILED ;
}
memset( output, 0x2a, *olen );
- return( 0 );
+ return 0 ;
}
/*
@@ -71,19 +71,19 @@
int buffer_nv_seed_read( unsigned char *buf, size_t buf_len )
{
if( buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE )
- return( -1 );
+ return -1 ;
memcpy( buf, buffer_seed, MBEDTLS_ENTROPY_BLOCK_SIZE );
- return( 0 );
+ return 0 ;
}
int buffer_nv_seed_write( unsigned char *buf, size_t buf_len )
{
if( buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE )
- return( -1 );
+ return -1 ;
memcpy( buffer_seed, buf, MBEDTLS_ENTROPY_BLOCK_SIZE );
- return( 0 );
+ return 0 ;
}
/*
@@ -94,18 +94,18 @@
FILE *f;
if( buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE )
- return( -1 );
+ return -1 ;
if( ( f = fopen( MBEDTLS_PLATFORM_STD_NV_SEED_FILE, "w" ) ) == NULL )
- return( -1 );
+ return -1 ;
if( fwrite( buf, 1, MBEDTLS_ENTROPY_BLOCK_SIZE, f ) !=
MBEDTLS_ENTROPY_BLOCK_SIZE )
- return( -1 );
+ return -1 ;
fclose( f );
- return( 0 );
+ return 0 ;
}
int read_nv_seed( unsigned char *buf, size_t buf_len )
@@ -113,18 +113,18 @@
FILE *f;
if( buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE )
- return( -1 );
+ return -1 ;
if( ( f = fopen( MBEDTLS_PLATFORM_STD_NV_SEED_FILE, "rb" ) ) == NULL )
- return( -1 );
+ return -1 ;
if( fread( buf, 1, MBEDTLS_ENTROPY_BLOCK_SIZE, f ) !=
MBEDTLS_ENTROPY_BLOCK_SIZE )
- return( -1 );
+ return -1 ;
fclose( f );
- return( 0 );
+ return 0 ;
}
#endif /* MBEDTLS_ENTROPY_NV_SEED */
/* END_HEADER */