From 3d2f949c86914616d974dbe2de56a162cc7b61f5 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Mon, 17 Dec 2018 23:17:17 +0100 Subject: [PATCH] Move the ARRAY_LENGTH macro to the common helpers file --- tests/suites/helpers.function | 3 +++ tests/suites/test_suite_psa_crypto.function | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function index cbe3fa0d4..38c16ad50 100644 --- a/tests/suites/helpers.function +++ b/tests/suites/helpers.function @@ -150,6 +150,9 @@ typedef struct data_tag mbedtls_exit( 1 ); \ } +/** Return the number of elements of a static or stack array. */ +#define ARRAY_LENGTH( array ) \ + ( sizeof( array ) / sizeof( *( array ) ) ) /* * 32-bit integer manipulation macros (big endian) */ diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function index c40ac5f7d..311a48d6c 100644 --- a/tests/suites/test_suite_psa_crypto.function +++ b/tests/suites/test_suite_psa_crypto.function @@ -13,8 +13,6 @@ #define MAX( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) -#define ARRAY_LENGTH( array ) ( sizeof( array ) / sizeof( *( array ) ) ) - #if(UINT32_MAX > SIZE_MAX) #define PSA_CRYPTO_TEST_SIZE_T_RANGE( x ) ( ( x ) <= SIZE_MAX ) #else