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 -4
View File
@@ -23,6 +23,7 @@
****************************************************************************/
#include <sys/types.h>
#include <sys/param.h>
#include <termios.h>
#include <assert.h>
#include <errno.h>
@@ -34,8 +35,6 @@
#define CBAUD 0010017 /* Baud speed mask (not in POSIX) */
#define BOTHER 0010000 /* Magic token for custom baud rate */
#define ARRAYSIZE(a) (sizeof((a))/sizeof(a[0]))
/****************************************************************************
* Private Type Definitions
****************************************************************************/
@@ -147,7 +146,7 @@ int cfsetspeed(FAR struct termios *termiosp, speed_t speed)
size_t idx;
DEBUGASSERT(termiosp);
for (idx = 0; idx < ARRAYSIZE(g_baud_table); idx++)
for (idx = 0; idx < nitems(g_baud_table); idx++)
{
if (speed == g_baud_table[idx].mask)
{
@@ -162,7 +161,7 @@ int cfsetspeed(FAR struct termios *termiosp, speed_t speed)
}
}
if (idx == ARRAYSIZE(g_baud_table))
if (idx == nitems(g_baud_table))
{
termiosp->c_speed = speed;
speed = BOTHER;