nuttx: replace all ARRAY_SIZE()/ARRAYSIZE() to nitems()

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an
2023-02-02 20:31:22 +08:00
committed by Xiang Xiao
parent cf0769d613
commit 3a0fdb019d
95 changed files with 291 additions and 451 deletions
+3 -5
View File
@@ -29,6 +29,8 @@
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <nuttx/kmalloc.h>
#include <nuttx/list.h>
#include <nuttx/power/consumer.h>
@@ -38,10 +40,6 @@
* Pre-processor Definitions
****************************************************************************/
#ifndef ARRAY_SIZE
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif
#define REGULATOR_RPMSG_EPT_NAME "rpmsg-regulator"
#define REGULATOR_RPMSG_ENABLE 0
@@ -400,7 +398,7 @@ static int regulator_rpmsg_ept_cb(FAR struct rpmsg_endpoint *ept,
nxsem_post(&cookie->sem);
ret = 0;
}
else if (cmd < ARRAY_SIZE(g_regulator_rpmsg_handler)
else if (cmd < nitems(g_regulator_rpmsg_handler)
&& g_regulator_rpmsg_handler[cmd])
{
header->response = 1;