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/chacha20.c b/library/chacha20.c
index 78467d3..87553bb 100644
--- a/library/chacha20.c
+++ b/library/chacha20.c
@@ -221,7 +221,7 @@
ctx->state[10] = BYTES_TO_U32_LE( key, 24 );
ctx->state[11] = BYTES_TO_U32_LE( key, 28 );
- return( 0 );
+ return 0 ;
}
int mbedtls_chacha20_starts( mbedtls_chacha20_context* ctx,
@@ -244,7 +244,7 @@
/* Initially, there's no keystream bytes available */
ctx->keystream_bytes_used = CHACHA20_BLOCK_SIZE_BYTES;
- return( 0 );
+ return 0 ;
}
int mbedtls_chacha20_update( mbedtls_chacha20_context *ctx,
@@ -309,7 +309,7 @@
}
- return( 0 );
+ return 0 ;
}
int mbedtls_chacha20_crypt( const unsigned char key[32],
@@ -341,7 +341,7 @@
cleanup:
mbedtls_chacha20_free( &ctx );
- return( ret );
+ return ret ;
}
#endif /* !MBEDTLS_CHACHA20_ALT */
@@ -525,7 +525,7 @@
if( verbose != 0 ) \
mbedtls_printf args; \
\
- return( -1 ); \
+ return -1 ; \
} \
} \
while( 0 )
@@ -560,7 +560,7 @@
if( verbose != 0 )
mbedtls_printf( "\n" );
- return( 0 );
+ return 0 ;
}
#endif /* MBEDTLS_SELF_TEST */