mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-21 21:36:21 +01:00
Improve macro hygiene
This commit improves hygiene and formatting of macro definitions
throughout the library. Specifically:
- It adds brackets around parameters to avoid unintended
interpretation of arguments, e.g. due to operator precedence.
- It adds uses of the `do { ... } while( 0 )` idiom for macros that
can be used as commands.
This commit is contained in:
parent
20d707dd3e
commit
d6028a1894
23 changed files with 325 additions and 252 deletions
|
|
@ -163,7 +163,7 @@ do { \
|
|||
|
||||
#define MEMORY_MEASURE_PRINT( title_len ) \
|
||||
mbedtls_memory_buffer_alloc_max_get( &max_used, &max_blocks ); \
|
||||
for( ii = 12 - title_len; ii != 0; ii-- ) mbedtls_printf( " " ); \
|
||||
for( ii = 12 - (title_len); ii != 0; ii-- ) mbedtls_printf( " " ); \
|
||||
max_used -= prv_used; \
|
||||
max_blocks -= prv_blocks; \
|
||||
max_bytes = max_used + MEM_BLOCK_OVERHEAD * max_blocks; \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue