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/psa/crypto_examples.c b/programs/psa/crypto_examples.c
index 935d657..80fe67e 100644
--- a/programs/psa/crypto_examples.c
+++ b/programs/psa/crypto_examples.c
@@ -54,7 +54,7 @@
"and/or MBEDTLS_CIPHER_MODE_WITH_PADDING "
"not defined and/or MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER"
" defined.\r\n" );
- return( 0 );
+ return 0 ;
}
#else
@@ -91,7 +91,7 @@
*output_len += len;
exit:
- return( status );
+ return status ;
}
static psa_status_t cipher_encrypt( psa_key_id_t key,
@@ -122,7 +122,7 @@
exit:
psa_cipher_abort( &operation );
- return( status );
+ return status ;
}
static psa_status_t cipher_decrypt( psa_key_id_t key,
@@ -152,7 +152,7 @@
exit:
psa_cipher_abort( &operation );
- return( status );
+ return status ;
}
static psa_status_t
@@ -201,7 +201,7 @@
exit:
psa_destroy_key( key );
- return( status );
+ return status ;
}
static psa_status_t cipher_example_encrypt_decrypt_aes_cbc_pkcs7_multi( void )
@@ -249,7 +249,7 @@
exit:
psa_destroy_key( key );
- return( status );
+ return status ;
}
static psa_status_t cipher_example_encrypt_decrypt_aes_ctr_multi( void )
@@ -296,7 +296,7 @@
exit:
psa_destroy_key( key );
- return( status );
+ return status ;
}
static void cipher_examples( void )
@@ -325,7 +325,7 @@
cipher_examples( );
exit:
mbedtls_psa_crypto_free( );
- return( 0 );
+ return 0 ;
}
#endif /* MBEDTLS_PSA_CRYPTO_C && MBEDTLS_AES_C && MBEDTLS_CIPHER_MODE_CBC &&
MBEDTLS_CIPHER_MODE_CTR && MBEDTLS_CIPHER_MODE_WITH_PADDING */