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_mdx.function b/tests/suites/test_suite_mdx.function
index 73f9123..5cdb1a5 100644
--- a/tests/suites/test_suite_mdx.function
+++ b/tests/suites/test_suite_mdx.function
@@ -10,8 +10,8 @@
unsigned char src_str[100];
unsigned char output[16];
- memset( src_str, 0x00, sizeof src_str );
- memset( output, 0x00, sizeof output );
+ memset( src_str, 0x00, sizeof(src_str) );
+ memset( output, 0x00, sizeof(output) );
strncpy( (char *) src_str, text_src_string, sizeof(src_str) - 1 );
@@ -19,7 +19,7 @@
TEST_ASSERT( ret == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
- sizeof output, hash->len ) == 0 );
+ sizeof( output), hash->len ) == 0 );
}
/* END_CASE */
@@ -30,8 +30,8 @@
unsigned char src_str[100];
unsigned char output[20];
- memset(src_str, 0x00, sizeof src_str);
- memset(output, 0x00, sizeof output);
+ memset(src_str, 0x00, sizeof(src_str));
+ memset(output, 0x00, sizeof(output));
strncpy( (char *) src_str, text_src_string, sizeof(src_str) - 1 );
@@ -39,7 +39,7 @@
TEST_ASSERT( ret == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
- sizeof output, hash->len ) == 0 );
+ sizeof(output), hash->len ) == 0 );
}
/* END_CASE */