mirror of
https://github.com/apache/nuttx.git
synced 2026-05-26 10:46:28 +08:00
nuttx: replace all ARRAY_SIZE()/ARRAYSIZE() to nitems()
Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
@@ -50,6 +50,8 @@
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/kthread.h>
|
||||
#include <nuttx/spinlock.h>
|
||||
@@ -69,8 +71,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
|
||||
/* Wait up to 2.5 seconds for a response. This delay is arbitrary and
|
||||
* intended only to avoid hangs while waiting for a response. It may need
|
||||
* to be adjusted.
|
||||
@@ -2139,7 +2139,7 @@ FAR const char *bt_addr_str(FAR const bt_addr_t *addr)
|
||||
FAR char *str;
|
||||
|
||||
str = bufs[cur++];
|
||||
cur %= ARRAY_SIZE(bufs);
|
||||
cur %= nitems(bufs);
|
||||
bt_addr_to_str(addr, str, sizeof(bufs[cur]));
|
||||
|
||||
return str;
|
||||
@@ -2152,7 +2152,7 @@ FAR const char *bt_addr_le_str(FAR const bt_addr_le_t *addr)
|
||||
FAR char *str;
|
||||
|
||||
str = bufs[cur++];
|
||||
cur %= ARRAY_SIZE(bufs);
|
||||
cur %= nitems(bufs);
|
||||
bt_addr_le_to_str(addr, str, sizeof(bufs[cur]));
|
||||
|
||||
return str;
|
||||
|
||||
@@ -44,6 +44,8 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <nuttx/wireless/bluetooth/bt_hci.h>
|
||||
#include <nuttx/wireless/bluetooth/bt_core.h>
|
||||
|
||||
@@ -61,8 +63,6 @@
|
||||
#define RECV_KEYS (BT_SMP_DIST_ID_KEY | BT_SMP_DIST_ENC_KEY)
|
||||
#define SEND_KEYS (BT_SMP_DIST_ENC_KEY)
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
@@ -326,7 +326,7 @@ static const char *h(FAR const void *buf, size_t len)
|
||||
int i;
|
||||
|
||||
str = hexbufs[curbuf++];
|
||||
curbuf %= ARRAY_SIZE(hexbufs);
|
||||
curbuf %= nitems(hexbufs);
|
||||
|
||||
maxlen = (sizeof(hexbufs[0]) - 1) / 2;
|
||||
if (len > maxlen)
|
||||
|
||||
Reference in New Issue
Block a user