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/scripts/data_files/error.fmt b/scripts/data_files/error.fmt
index 3be94bd..6c2b487 100644
--- a/scripts/data_files/error.fmt
+++ b/scripts/data_files/error.fmt
@@ -56,7 +56,7 @@
break;
}
- return( NULL );
+ return NULL ;
}
const char * mbedtls_low_level_strerr( int error_code )
@@ -79,7 +79,7 @@
break;
}
- return( NULL );
+ return NULL ;
}
void mbedtls_strerror( int ret, char *buf, size_t buflen )
diff --git a/scripts/data_files/query_config.fmt b/scripts/data_files/query_config.fmt
index ffa816e..77f628f 100644
--- a/scripts/data_files/query_config.fmt
+++ b/scripts/data_files/query_config.fmt
@@ -115,7 +115,7 @@
int query_config( const char *config )
{
CHECK_CONFIG /* If the symbol is not found, return an error */
- return( 1 );
+ return 1 ;
}
#if defined(_MSC_VER)
diff --git a/scripts/data_files/version_features.fmt b/scripts/data_files/version_features.fmt
index d4bf774..e572c5e 100644
--- a/scripts/data_files/version_features.fmt
+++ b/scripts/data_files/version_features.fmt
@@ -37,18 +37,18 @@
const char * const *idx = features;
if( *idx == NULL )
- return( -2 );
+ return -2 ;
if( feature == NULL )
- return( -1 );
+ return -1 ;
while( *idx != NULL )
{
if( !strcmp( *idx, feature ) )
- return( 0 );
+ return 0 ;
idx++;
}
- return( -1 );
+ return -1 ;
}
#endif /* MBEDTLS_VERSION_C */