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/library/md5.c b/library/md5.c
index d7f8cee..9761316 100644
--- a/library/md5.c
+++ b/library/md5.c
@@ -98,7 +98,7 @@
ctx->state[2] = 0x98BADCFE;
ctx->state[3] = 0x10325476;
- return( 0 );
+ return 0 ;
}
#if !defined(MBEDTLS_MD5_PROCESS_ALT)
@@ -234,7 +234,7 @@
/* Zeroise variables to clear sensitive data from memory. */
mbedtls_platform_zeroize( &local, sizeof( local ) );
- return( 0 );
+ return 0 ;
}
#endif /* !MBEDTLS_MD5_PROCESS_ALT */
@@ -251,7 +251,7 @@
uint32_t left;
if( ilen == 0 )
- return( 0 );
+ return 0 ;
left = ctx->total[0] & 0x3F;
fill = 64 - left;
@@ -266,7 +266,7 @@
{
memcpy( (void *) (ctx->buffer + left), input, fill );
if( ( ret = mbedtls_internal_md5_process( ctx, ctx->buffer ) ) != 0 )
- return( ret );
+ return ret ;
input += fill;
ilen -= fill;
@@ -276,7 +276,7 @@
while( ilen >= 64 )
{
if( ( ret = mbedtls_internal_md5_process( ctx, input ) ) != 0 )
- return( ret );
+ return ret ;
input += 64;
ilen -= 64;
@@ -287,7 +287,7 @@
memcpy( (void *) (ctx->buffer + left), input, ilen );
}
- return( 0 );
+ return 0 ;
}
/*
@@ -318,7 +318,7 @@
memset( ctx->buffer + used, 0, 64 - used );
if( ( ret = mbedtls_internal_md5_process( ctx, ctx->buffer ) ) != 0 )
- return( ret );
+ return ret ;
memset( ctx->buffer, 0, 56 );
}
@@ -334,7 +334,7 @@
PUT_UINT32_LE( high, ctx->buffer, 60 );
if( ( ret = mbedtls_internal_md5_process( ctx, ctx->buffer ) ) != 0 )
- return( ret );
+ return ret ;
/*
* Output final state
@@ -344,7 +344,7 @@
PUT_UINT32_LE( ctx->state[2], output, 8 );
PUT_UINT32_LE( ctx->state[3], output, 12 );
- return( 0 );
+ return 0 ;
}
#endif /* !MBEDTLS_MD5_ALT */
@@ -373,7 +373,7 @@
exit:
mbedtls_md5_free( &ctx );
- return( ret );
+ return ret ;
}
#if defined(MBEDTLS_SELF_TEST)
@@ -444,13 +444,13 @@
if( verbose != 0 )
mbedtls_printf( "\n" );
- return( 0 );
+ return 0 ;
fail:
if( verbose != 0 )
mbedtls_printf( "failed\n" );
- return( ret );
+ return ret ;
}
#endif /* MBEDTLS_SELF_TEST */