Unify to use ARRAY_SIZE in TF-M codes
ARRAY_SIZE(foo) is preferred over sizeof(foo)/sizeof(foo[0]).
Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: I6d95ceece2edc6267491923e282e28710b68ab8d
diff --git a/interface/src/tfm_audit_func_api.c b/interface/src/tfm_audit_func_api.c
index 3439635..4141970 100644
--- a/interface/src/tfm_audit_func_api.c
+++ b/interface/src/tfm_audit_func_api.c
@@ -1,29 +1,28 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
+#include "psa/client.h"
#include "psa_audit_api.h"
#include "tfm_veneers.h"
#include "tfm_ns_interface.h"
-#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
-
#define API_DISPATCH(sfn_name) \
tfm_ns_interface_dispatch((veneer_fn)tfm_##sfn_name##_veneer, \
- (uint32_t)in_vec, (uint32_t)ARRAY_SIZE(in_vec), \
- (uint32_t)out_vec, (uint32_t)ARRAY_SIZE(out_vec))
+ (uint32_t)in_vec, IOVEC_LEN(in_vec), \
+ (uint32_t)out_vec, IOVEC_LEN(out_vec))
#define API_DISPATCH_NO_INVEC(sfn_name) \
tfm_ns_interface_dispatch((veneer_fn)tfm_##sfn_name##_veneer, \
(uint32_t)NULL, 0, \
- (uint32_t)out_vec, (uint32_t)ARRAY_SIZE(out_vec))
+ (uint32_t)out_vec, IOVEC_LEN(out_vec))
#define API_DISPATCH_NO_OUTVEC(sfn_name) \
tfm_ns_interface_dispatch((veneer_fn)tfm_##sfn_name##_veneer, \
- (uint32_t)in_vec, (uint32_t)ARRAY_SIZE(in_vec), \
+ (uint32_t)in_vec, IOVEC_LEN(in_vec), \
(uint32_t)NULL, 0)
psa_status_t psa_audit_retrieve_record(const uint32_t record_index,