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/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c
index 25fe21b..5477096 100644
--- a/programs/ssl/ssl_client2.c
+++ b/programs/ssl/ssl_client2.c
@@ -518,7 +518,7 @@
memcpy( peer_crt_info, buf, sizeof( buf ) );
if( opt.debug_level == 0 )
- return( 0 );
+ return 0 ;
mbedtls_printf( "%s", buf );
#else
@@ -534,7 +534,7 @@
mbedtls_printf( "%s\n", buf );
}
- return( 0 );
+ return 0 ;
}
#endif /* MBEDTLS_X509_CRT_PARSE_C */
@@ -548,7 +548,7 @@
int cid_negotiated;
if( opt.transport != MBEDTLS_SSL_TRANSPORT_DATAGRAM )
- return( 0 );
+ return 0 ;
/* Check if the use of a CID has been negotiated,
* but don't ask for the CID value and length.
@@ -566,7 +566,7 @@
{
mbedtls_printf( " failed\n ! mbedtls_ssl_get_peer_cid returned -0x%x\n\n",
(unsigned int) -ret );
- return( ret );
+ return ret ;
}
if( cid_negotiated == MBEDTLS_SSL_CID_DISABLED )
@@ -590,7 +590,7 @@
{
mbedtls_printf( " failed\n ! mbedtls_ssl_get_peer_cid returned -0x%x\n\n",
(unsigned int) -ret );
- return( ret );
+ return ret ;
}
/* Ask for just length + value of the peer's CID. */
@@ -600,7 +600,7 @@
{
mbedtls_printf( " failed\n ! mbedtls_ssl_get_peer_cid returned -0x%x\n\n",
(unsigned int) -ret );
- return( ret );
+ return ret ;
}
mbedtls_printf( "(%s) Peer CID (length %u Bytes): ",
additional_description,
@@ -613,7 +613,7 @@
mbedtls_printf( "\n" );
}
- return( 0 );
+ return 0 ;
}
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */