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/programs/x509/cert_app.c b/programs/x509/cert_app.c
index aab15db..65276e7 100644
--- a/programs/x509/cert_app.c
+++ b/programs/x509/cert_app.c
@@ -138,7 +138,7 @@
mbedtls_printf( "%s\n", buf );
}
- return( 0 );
+ return 0 ;
}
int main( int argc, char *argv[] )
diff --git a/programs/x509/cert_req.c b/programs/x509/cert_req.c
index ed42079..03dbd20 100644
--- a/programs/x509/cert_req.c
+++ b/programs/x509/cert_req.c
@@ -129,22 +129,22 @@
memset( output_buf, 0, 4096 );
if( ( ret = mbedtls_x509write_csr_pem( req, output_buf, 4096, f_rng, p_rng ) ) < 0 )
- return( ret );
+ return ret ;
len = strlen( (char *) output_buf );
if( ( f = fopen( output_file, "w" ) ) == NULL )
- return( -1 );
+ return -1 ;
if( fwrite( output_buf, 1, len, f ) != len )
{
fclose( f );
- return( -1 );
+ return -1 ;
}
fclose( f );
- return( 0 );
+ return 0 ;
}
int main( int argc, char *argv[] )
diff --git a/programs/x509/cert_write.c b/programs/x509/cert_write.c
index 9a20d63..72e823f 100644
--- a/programs/x509/cert_write.c
+++ b/programs/x509/cert_write.c
@@ -191,22 +191,22 @@
memset( output_buf, 0, 4096 );
if( ( ret = mbedtls_x509write_crt_pem( crt, output_buf, 4096,
f_rng, p_rng ) ) < 0 )
- return( ret );
+ return ret ;
len = strlen( (char *) output_buf );
if( ( f = fopen( output_file, "w" ) ) == NULL )
- return( -1 );
+ return -1 ;
if( fwrite( output_buf, 1, len, f ) != len )
{
fclose( f );
- return( -1 );
+ return -1 ;
}
fclose( f );
- return( 0 );
+ return 0 ;
}
int main( int argc, char *argv[] )