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/ssl_cache.c b/library/ssl_cache.c
index fe4f30c..a2ee0a2 100644
--- a/library/ssl_cache.c
+++ b/library/ssl_cache.c
@@ -85,7 +85,7 @@
ret = 0;
}
- return( ret );
+ return ret ;
}
@@ -100,7 +100,7 @@
#if defined(MBEDTLS_THREADING_C)
if( mbedtls_mutex_lock( &cache->mutex ) != 0 )
- return( 1 );
+ return 1 ;
#endif
ret = ssl_cache_find_entry( cache, session_id, session_id_len, &entry );
@@ -121,7 +121,7 @@
ret = 1;
#endif
- return( ret );
+ return ret ;
}
static int ssl_cache_pick_writing_slot( mbedtls_ssl_cache_context *cache,
@@ -188,7 +188,7 @@
/* Create new entry */
cur = mbedtls_calloc( 1, sizeof(mbedtls_ssl_cache_entry) );
if( cur == NULL )
- return( 1 );
+ return 1 ;
/* Append to the end of the linked list. */
if( last == NULL )
@@ -208,12 +208,12 @@
{
/* This should only happen on an ill-configured cache
* with max_entries == 0. */
- return( 1 );
+ return 1 ;
}
#else /* MBEDTLS_HAVE_TIME */
/* Reuse first entry in chain, but move to last place. */
if( cache->chain == NULL )
- return( 1 );
+ return 1 ;
old = cache->chain;
cache->chain = old->next;
@@ -241,7 +241,7 @@
}
*dst = cur;
- return( 0 );
+ return 0 ;
}
int mbedtls_ssl_cache_set( void *data,
@@ -258,7 +258,7 @@
#if defined(MBEDTLS_THREADING_C)
if( ( ret = mbedtls_mutex_lock( &cache->mutex ) ) != 0 )
- return( ret );
+ return ret ;
#endif
ret = ssl_cache_pick_writing_slot( cache,
@@ -314,7 +314,7 @@
if( session_serialized != NULL )
mbedtls_platform_zeroize( session_serialized, session_serialized_len );
- return( ret );
+ return ret ;
}
#if defined(MBEDTLS_HAVE_TIME)