Change all sizeof(arr)/sizeof(arr[0]) to nitems
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
8e8d58a915
commit
054cf3b1cb
@ -25,6 +25,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <nuttx/lib/builtin.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
@ -52,7 +53,7 @@ const struct builtin_s g_builtins[] =
|
||||
#endif
|
||||
};
|
||||
|
||||
const int g_builtin_count = sizeof(g_builtins) / sizeof(g_builtins[0]);
|
||||
const int g_builtin_count = nitems(g_builtins);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h> /* for sa_family_t */
|
||||
#include <nuttx/can.h>
|
||||
#include <netpacket/can.h>
|
||||
@ -496,10 +497,6 @@ static const char *protocol_violation_locations[] = {
|
||||
"unspecified",
|
||||
};
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
||||
#endif
|
||||
|
||||
static int snprintf_error_data(char *buf, size_t len, uint8_t err,
|
||||
const char **arr, int arr_len)
|
||||
{
|
||||
@ -537,7 +534,7 @@ static int snprintf_error_ctrl(char *buf, size_t len, const struct canfd_frame *
|
||||
n += snprintf(buf + n, len - n, "{");
|
||||
n += snprintf_error_data(buf + n, len - n, cf->data[1],
|
||||
controller_problems,
|
||||
ARRAY_SIZE(controller_problems));
|
||||
nitems(controller_problems));
|
||||
n += snprintf(buf + n, len - n, "}");
|
||||
|
||||
return n;
|
||||
@ -553,10 +550,10 @@ static int snprintf_error_prot(char *buf, size_t len, const struct canfd_frame *
|
||||
n += snprintf(buf + n, len - n, "{{");
|
||||
n += snprintf_error_data(buf + n, len - n, cf->data[2],
|
||||
protocol_violation_types,
|
||||
ARRAY_SIZE(protocol_violation_types));
|
||||
nitems(protocol_violation_types));
|
||||
n += snprintf(buf + n, len - n, "}{");
|
||||
if (cf->data[3] > 0 &&
|
||||
cf->data[3] < ARRAY_SIZE(protocol_violation_locations))
|
||||
cf->data[3] < nitems(protocol_violation_locations))
|
||||
n += snprintf(buf + n, len - n, "%s",
|
||||
protocol_violation_locations[cf->data[3]]);
|
||||
n += snprintf(buf + n, len - n, "}}");
|
||||
@ -575,7 +572,7 @@ void snprintf_can_error_frame(char *buf, size_t len, const struct canfd_frame *c
|
||||
return;
|
||||
|
||||
class = cf->can_id & CAN_EFF_MASK;
|
||||
if (class > (1 << ARRAY_SIZE(error_classes))) {
|
||||
if (class > (1 << nitems(error_classes))) {
|
||||
fprintf(stderr, "Error class %#jx is invalid\n", (uintmax_t)class);
|
||||
return;
|
||||
}
|
||||
@ -583,7 +580,7 @@ void snprintf_can_error_frame(char *buf, size_t len, const struct canfd_frame *c
|
||||
if (!sep)
|
||||
sep = defsep;
|
||||
|
||||
for (i = 0; i < (int)ARRAY_SIZE(error_classes); i++) {
|
||||
for (i = 0; i < (int)nitems(error_classes); i++) {
|
||||
mask = 1 << i;
|
||||
if (class & mask) {
|
||||
if (classes)
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
@ -41,7 +41,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ARRAYSIZE(x) (sizeof((x)) / sizeof((x)[0]))
|
||||
#define PASSED 0
|
||||
|
||||
#define SUB_PROMPT "stst >"
|
||||
@ -394,7 +393,7 @@ int main(int argc, FAR char *argv[])
|
||||
adxl372_test, /* ADXL372 accelerometer tests */
|
||||
};
|
||||
|
||||
FAR char *test_path[ARRAYSIZE(test_ptr_array)];
|
||||
FAR char *test_path[nitems(test_ptr_array)];
|
||||
|
||||
if (argc < 1 || *argv[1] == 0 || *(argv[1] + 1) == 0)
|
||||
{
|
||||
@ -490,7 +489,7 @@ int main(int argc, FAR char *argv[])
|
||||
printf("Set to batch mode.\n");
|
||||
}
|
||||
}
|
||||
else if (ui >= ARRAYSIZE(test_ptr_array))
|
||||
else if (ui >= nitems(test_ptr_array))
|
||||
{
|
||||
printf("Huh?\n");
|
||||
}
|
||||
@ -511,7 +510,7 @@ int main(int argc, FAR char *argv[])
|
||||
{
|
||||
printf("ADXL372 sensor diagnostic started in batch mode...\n");
|
||||
|
||||
for (ui = 0; ui < ARRAYSIZE(test_ptr_array); ui++)
|
||||
for (ui = 0; ui < nitems(test_ptr_array); ui++)
|
||||
{
|
||||
step_rc = 0;
|
||||
if (test_ptr_array[ui] != 0)
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/param.h>
|
||||
#include <nuttx/analog/dac.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
@ -47,10 +48,6 @@
|
||||
# define CONFIG_EXAMPLES_DAC_DEVPATH "/dev/dac0"
|
||||
#endif
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
@ -226,7 +223,7 @@ static int cmd_dac_put(int argc, FAR const char *argv[])
|
||||
{
|
||||
msgs[0].am_channel = g_dacstate.channel;
|
||||
msgs[0].am_data = data;
|
||||
ret = dac_put(g_dacstate.devpath, msgs, ARRAY_SIZE(msgs), delay);
|
||||
ret = dac_put(g_dacstate.devpath, msgs, nitems(msgs), delay);
|
||||
printf("ret=%d\n", ret);
|
||||
}
|
||||
|
||||
@ -277,7 +274,7 @@ static void dac_help(void)
|
||||
"Default: %s Current: %s\n",
|
||||
CONFIG_EXAMPLES_DAC_DEVPATH,
|
||||
g_dacstate.devpath ? g_dacstate.devpath : "NONE");
|
||||
print_cmds("\nCommands:\n", commands, ARRAY_SIZE(commands), "\n");
|
||||
print_cmds("\nCommands:\n", commands, nitems(commands), "\n");
|
||||
}
|
||||
|
||||
static int arg_string(FAR const char **arg, FAR const char **value)
|
||||
@ -422,7 +419,7 @@ int main(int argc, FAR const char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = execute_cmd(argc, argv, commands, ARRAY_SIZE(commands));
|
||||
ret = execute_cmd(argc, argv, commands, nitems(commands));
|
||||
}
|
||||
|
||||
return (ret >= 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <nuttx/lcd/ft80x.h>
|
||||
|
||||
#include "graphics/ft80x.h"
|
||||
@ -88,7 +89,6 @@ static const struct ft80x_exampleinfo_s g_primitives[] =
|
||||
{ "Alpha Blend", ft80x_prim_alphablend }
|
||||
};
|
||||
|
||||
#define NPRIMITIVES (sizeof(g_primitives) / sizeof(struct ft80x_exampleinfo_s))
|
||||
#endif /* CONFIG_EXAMPLES_FT80X_PRIMITIVES */
|
||||
|
||||
/* Co-processor display examples. Only a small, but interesting, subset
|
||||
@ -139,8 +139,6 @@ static const struct ft80x_exampleinfo_s g_coproc[] =
|
||||
{ "Logo", ft80x_coproc_logo }
|
||||
};
|
||||
|
||||
#define NCOPROC (sizeof(g_coproc) / sizeof(struct ft80x_exampleinfo_s))
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
@ -308,7 +306,7 @@ int main(int argc, FAR char *argv[])
|
||||
|
||||
ft80x_info("FT80x Primitive Functions\n");
|
||||
|
||||
for (i = 0; i < NPRIMITIVES; i++)
|
||||
for (i = 0; i < nitems(g_primitives); i++)
|
||||
{
|
||||
ft80x_example(fd, buffer, &g_primitives[i]);
|
||||
}
|
||||
@ -318,7 +316,7 @@ int main(int argc, FAR char *argv[])
|
||||
|
||||
ft80x_info("FT80x Co-processor Functions\n");
|
||||
|
||||
for (i = 0; i < NCOPROC; i++)
|
||||
for (i = 0; i < nitems(g_coproc); i++)
|
||||
{
|
||||
ft80x_example(fd, buffer, &g_coproc[i]);
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
@ -65,7 +66,6 @@ static const struct fptd_account_s g_ftpdaccounts[] =
|
||||
{ FTPD_ACCOUNTFLAG_GUEST, "ftp", NULL, NULL },
|
||||
{ FTPD_ACCOUNTFLAG_GUEST, "anonymous", NULL, NULL },
|
||||
};
|
||||
#define NACCOUNTS (sizeof(g_ftpdaccounts) / sizeof(struct fptd_account_s))
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
@ -139,7 +139,7 @@ static void ftpd_accounts(FTPD_SESSION handle)
|
||||
int i;
|
||||
|
||||
printf("Adding accounts:\n");
|
||||
for (i = 0; i < NACCOUNTS; i++)
|
||||
for (i = 0; i < nitems(g_ftpdaccounts); i++)
|
||||
{
|
||||
account = &g_ftpdaccounts[i];
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
@ -41,7 +41,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ARRAYSIZE(x) (sizeof((x)) / sizeof((x)[0]))
|
||||
#define PASSED 0
|
||||
|
||||
#define SUB_PROMPT "stst >"
|
||||
@ -631,7 +630,7 @@ int main(int argc, FAR char *argv[])
|
||||
lsm330gyro_test, /* LSM330 gyroscope tests */
|
||||
};
|
||||
|
||||
FAR char *test_path[ARRAYSIZE(test_ptr_array)];
|
||||
FAR char *test_path[nitems(test_ptr_array)];
|
||||
|
||||
if (argc < 2 || *argv[1] == 0 || *(argv[1] + 1) == 0)
|
||||
{
|
||||
@ -737,7 +736,7 @@ int main(int argc, FAR char *argv[])
|
||||
printf("Set to batch mode.\n");
|
||||
}
|
||||
}
|
||||
else if (ui >= ARRAYSIZE(test_ptr_array))
|
||||
else if (ui >= nitems(test_ptr_array))
|
||||
{
|
||||
printf("Huh?\n");
|
||||
}
|
||||
@ -757,7 +756,7 @@ int main(int argc, FAR char *argv[])
|
||||
else /* not interactive mode */
|
||||
{
|
||||
printf("LSM330 sensor diagnostic started in batch mode...\n");
|
||||
for (ui = 0; ui < ARRAYSIZE(test_ptr_array); ui++)
|
||||
for (ui = 0; ui < nitems(test_ptr_array); ui++)
|
||||
{
|
||||
step_rc = 0;
|
||||
if (test_ptr_array[ui] != 0)
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include "graphics/curses.h"
|
||||
|
||||
@ -123,7 +124,7 @@ static const COMMAND command[] =
|
||||
#endif
|
||||
};
|
||||
|
||||
#define MAX_OPTIONS (sizeof(command) / sizeof(COMMAND))
|
||||
#define MAX_OPTIONS nitems(command)
|
||||
|
||||
static int height;
|
||||
static int width;
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <netinet/in.h>
|
||||
@ -58,10 +59,6 @@
|
||||
#define TEST_SOCKET_SOCKID_BASE 10000U
|
||||
#define TEST_SOCKET_COUNT 8
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
#define noinline
|
||||
|
||||
/****************************************************************************
|
||||
@ -140,7 +137,7 @@ static int test_socket_alloc(FAR struct daemon_priv_s *priv)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(priv->test_sockets); i++)
|
||||
for (i = 0; i < nitems(priv->test_sockets); i++)
|
||||
{
|
||||
FAR struct test_socket_s *tsock = &priv->test_sockets[i];
|
||||
|
||||
@ -172,7 +169,7 @@ static FAR struct test_socket_s *test_socket_get(
|
||||
}
|
||||
|
||||
sockid -= TEST_SOCKET_SOCKID_BASE;
|
||||
if (sockid >= ARRAY_SIZE(priv->test_sockets))
|
||||
if (sockid >= nitems(priv->test_sockets))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -245,13 +242,13 @@ static int tsock_send_event(int fd, FAR struct daemon_priv_s *priv,
|
||||
event.head.flags = USRSOCK_MESSAGE_FLAG_EVENT;
|
||||
event.head.msgid = USRSOCK_MESSAGE_SOCKET_EVENT;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(priv->test_sockets); i++)
|
||||
for (i = 0; i < nitems(priv->test_sockets); i++)
|
||||
{
|
||||
if (tsock == &priv->test_sockets[i])
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == ARRAY_SIZE(priv->test_sockets))
|
||||
if (i == nitems(priv->test_sockets))
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -1777,7 +1774,7 @@ static int for_each_connection(int fd, FAR struct daemon_priv_s *priv,
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(priv->test_sockets); i++)
|
||||
for (i = 0; i < nitems(priv->test_sockets); i++)
|
||||
{
|
||||
FAR struct test_socket_s *tsock = &priv->test_sockets[i];
|
||||
|
||||
@ -2114,7 +2111,7 @@ int usrsocktest_daemon_stop(void)
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(priv->test_sockets); i++)
|
||||
for (i = 0; i < nitems(priv->test_sockets); i++)
|
||||
{
|
||||
if (priv->test_sockets[i].opened && priv->test_sockets[i].endp != NULL)
|
||||
{
|
||||
|
@ -54,10 +54,6 @@
|
||||
|
||||
#define usrsocktest_dbg(...) ((void)0)
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
@ -22,6 +22,7 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <assert.h>
|
||||
#include <netinet/in.h>
|
||||
@ -34,10 +35,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
@ -115,12 +112,12 @@ TEST_SETUP(multithread)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(sds); i++)
|
||||
for (i = 0; i < nitems(sds); i++)
|
||||
{
|
||||
sds[i] = -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(tids); i++)
|
||||
for (i = 0; i < nitems(tids); i++)
|
||||
{
|
||||
tids[i] = -1;
|
||||
}
|
||||
@ -150,7 +147,7 @@ TEST_TEAR_DOWN(multithread)
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(tids); i++)
|
||||
for (i = 0; i < nitems(tids); i++)
|
||||
{
|
||||
if (tids[i] != -1)
|
||||
{
|
||||
@ -161,7 +158,7 @@ TEST_TEAR_DOWN(multithread)
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(sds); i++)
|
||||
for (i = 0; i < nitems(sds); i++)
|
||||
{
|
||||
if (sds[i] != -1)
|
||||
{
|
||||
@ -213,7 +210,7 @@ TEST(multithread, open_close)
|
||||
|
||||
/* Launch worker threads. */
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(tids); i++)
|
||||
for (i = 0; i < nitems(tids); i++)
|
||||
{
|
||||
ret = pthread_create(&tids[i], NULL, usrsock_socket_multitask_thread,
|
||||
sds + i);
|
||||
|
@ -38,10 +38,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
#define TEST_FLAG_PAUSE_USRSOCK_HANDLING (1 << 0)
|
||||
#define TEST_FLAG_DAEMON_ABORT (1 << 1)
|
||||
#define TEST_FLAG_MULTI_THREAD (1 << 2)
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/param.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@ -114,7 +115,7 @@ static uint32_t keypad_get_key(int fd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(g_keypad_map) / sizeof(struct keypad_map_s); i++)
|
||||
for (i = 0; i < nitems(g_keypad_map); i++)
|
||||
{
|
||||
int bit = g_keypad_map[i].bit;
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <assert.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include "bas_statement.h"
|
||||
|
||||
@ -1181,7 +1182,7 @@ struct Value *stmt_EDIT(struct Value *value)
|
||||
String_new(&cmd);
|
||||
String_appendChars(&cmd, visual);
|
||||
String_appendChar(&cmd, ' ');
|
||||
for (i = 0; i < sizeof(gotoLine) / sizeof(gotoLine[0]); ++i)
|
||||
for (i = 0; i < nitems(gotoLine); ++i)
|
||||
{
|
||||
if (strcmp(basename, gotoLine[i].editor) == 0)
|
||||
{
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
#include <nuttx/clock.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
@ -40,7 +41,7 @@
|
||||
#include <malloc.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/time.h>
|
||||
#include <nuttx/clock.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
@ -63,8 +64,6 @@
|
||||
#define DHCPV6_DUID_LLADDR 3
|
||||
#define DHCPV6_REQ_DELAY 1
|
||||
|
||||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
||||
|
||||
#define dhcpv6_for_each_option(_o, start, end, otype, olen, odata)\
|
||||
for ((_o) = (FAR uint8_t *)(start); (_o) + 4 <= (FAR uint8_t *)(end) &&\
|
||||
((otype) = (_o)[0] << 8 | (_o)[1]) && ((odata) = (FAR void *)&(_o)[4]) &&\
|
||||
@ -614,7 +613,7 @@ static void dhcp6c_send(FAR void *handle, enum dhcpv6_msg_e type,
|
||||
dhcp6c_set_iov(&iov[9], &hdr_ia_pd, sizeof(hdr_ia_pd));
|
||||
dhcp6c_set_iov(&iov[10], ia_pd, ia_pd_len);
|
||||
|
||||
cnt = ARRAY_SIZE(iov);
|
||||
cnt = nitems(iov);
|
||||
if (type == DHCPV6_MSG_INFO_REQ)
|
||||
{
|
||||
cnt = 5;
|
||||
|
@ -85,7 +85,7 @@ static void iperf_showusage(FAR const char *progname,
|
||||
printf("iperf command:\n");
|
||||
arg_print_glossary(stdout, (FAR void **)args, NULL);
|
||||
|
||||
arg_freetable((FAR void **)args, sizeof(*args) / sizeof(FAR void *));
|
||||
arg_freetable((FAR void **)args, 1);
|
||||
exit(exitcode);
|
||||
}
|
||||
|
||||
@ -301,8 +301,7 @@ int main(int argc, FAR char *argv[])
|
||||
iperf_start(&cfg);
|
||||
|
||||
out:
|
||||
arg_freetable((FAR void **)&iperf_args,
|
||||
sizeof(iperf_args) / sizeof(FAR void *));
|
||||
arg_freetable((FAR void **)&iperf_args, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
@ -100,10 +101,6 @@
|
||||
|
||||
#define MAX_SERVER_SELECTION_RETRIES 3
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
#ifndef STR
|
||||
# define STR2(x) #x
|
||||
# define STR(x) STR2(x)
|
||||
@ -1003,7 +1000,7 @@ static int ntp_get_next_hostip(FAR struct ntp_servers_s *srvs,
|
||||
/* Refresh DNS for new IP-addresses. */
|
||||
|
||||
ret = ntp_gethostip_multi(hostname, srvs->list,
|
||||
ARRAY_SIZE(srvs->list));
|
||||
nitems(srvs->list));
|
||||
if (ret <= 0)
|
||||
{
|
||||
return ERROR;
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
@ -1503,7 +1504,7 @@ static void figure_mime(httpd_conn *hc)
|
||||
if (ext_len == enc_tab[i].ext_len &&
|
||||
strncasecmp(ext, enc_tab[i].ext, ext_len) == 0)
|
||||
{
|
||||
if (n_me_indexes < sizeof(me_indexes) / sizeof(*me_indexes))
|
||||
if (n_me_indexes < nitems(me_indexes))
|
||||
{
|
||||
me_indexes[n_me_indexes] = i;
|
||||
++n_me_indexes;
|
||||
@ -3284,7 +3285,7 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowp)
|
||||
|
||||
/* Check for an index file. */
|
||||
|
||||
for (i = 0; i < sizeof(index_names) / sizeof(char *); ++i)
|
||||
for (i = 0; i < nitems(index_names); ++i)
|
||||
{
|
||||
httpd_realloc_str(&indexname, &maxindexname,
|
||||
expnlen + 1 + strlen(index_names[i]));
|
||||
|
@ -45,6 +45,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
@ -73,7 +74,7 @@ static struct mime_entry enc_tab[] =
|
||||
{ "gz", 0, "gzip", 0 },
|
||||
{ "uu", 0, "x-uuencode", 0 },
|
||||
};
|
||||
static const int n_enc_tab = sizeof(enc_tab) / sizeof(*enc_tab);
|
||||
static const int n_enc_tab = nitems(enc_tab);
|
||||
|
||||
/* A list of file extensions followed by the corresponding MIME type.
|
||||
* Extensions not found in the table are returned as text/plain.
|
||||
@ -273,6 +274,6 @@ static struct mime_entry typ_tab[] =
|
||||
{ "xyz", 0, "chemical/x-xyz", 0 },
|
||||
{ "zip", 0, "application/zip", 0 },
|
||||
};
|
||||
static const int n_typ_tab = sizeof(typ_tab) / sizeof(*typ_tab);
|
||||
static const int n_typ_tab = nitems(typ_tab);
|
||||
|
||||
#endif /* __APPS_NETUTILS_THTTPD_MIME_TYPES_H */
|
||||
|
@ -143,14 +143,13 @@ static int scan_wday(char *str_wday, long *tm_wdayP)
|
||||
|
||||
if (!sorted)
|
||||
{
|
||||
qsort(wday_tab, sizeof(wday_tab) / sizeof(struct strlong),
|
||||
qsort(wday_tab, nitems(wday_tab),
|
||||
sizeof(struct strlong), strlong_compare);
|
||||
sorted = 1;
|
||||
}
|
||||
|
||||
pound_case(str_wday);
|
||||
return strlong_search(str_wday, wday_tab,
|
||||
sizeof(wday_tab) / sizeof(struct strlong), tm_wdayP);
|
||||
return strlong_search(str_wday, wday_tab, nitems(wday_tab), tm_wdayP);
|
||||
}
|
||||
#endif /* Day of week not yet supported by NuttX */
|
||||
|
||||
@ -176,14 +175,13 @@ static int scan_mon(char *str_mon, long *tm_monP)
|
||||
|
||||
if (!sorted)
|
||||
{
|
||||
qsort(mon_tab, sizeof(mon_tab) / sizeof(struct strlong),
|
||||
qsort(mon_tab, nitems(mon_tab),
|
||||
sizeof(struct strlong), strlong_compare);
|
||||
sorted = 1;
|
||||
}
|
||||
|
||||
pound_case(str_mon);
|
||||
return strlong_search(str_mon, mon_tab,
|
||||
sizeof(mon_tab) / sizeof(struct strlong), tm_monP);
|
||||
return strlong_search(str_mon, mon_tab, nitems(mon_tab), tm_monP);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -57,12 +57,12 @@ config NETUTILS_HTTPD_CGIPATH
|
||||
used thus:
|
||||
|
||||
const static struct httpd_cgi_call a[] = {
|
||||
{ NULL, "/abc", cgi_abc },
|
||||
{ NULL, "/xyz", cgi_xyz }
|
||||
{ NULL, "/abc", cgi_abc },
|
||||
{ NULL, "/xyz", cgi_xyz }
|
||||
};
|
||||
|
||||
for (i = 0; i < sizeof a / sizeof *a; i++) {
|
||||
httpd_cgi_register(&a[i]);
|
||||
for (i = 0; i < nitems(a); i++) {
|
||||
httpd_cgi_register(&a[i]);
|
||||
}
|
||||
|
||||
Where (under NETUTILS_HTTPD_CGIPATH) the "/xyz" is a URL path,
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/param.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -988,7 +989,7 @@ int httpd_send_headers(struct httpd_state *pstate, int status, int len)
|
||||
{
|
||||
mime = "text/plain";
|
||||
|
||||
for (i = 0; i < sizeof a / sizeof *a; i++)
|
||||
for (i = 0; i < nitems(a); i++)
|
||||
{
|
||||
if (strncmp(a[i].ext, ptr + 1, strlen(a[i].ext)) == 0)
|
||||
{
|
||||
|
@ -455,6 +455,6 @@ int main(int argc, FAR char *argv[])
|
||||
printf("Unknown table: %s\n", args.table->sval[0]);
|
||||
}
|
||||
|
||||
arg_freetable((FAR void **)&args, sizeof(args) / sizeof(FAR void *));
|
||||
arg_freetable((FAR void **)&args, 1);
|
||||
return ret;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <strings.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <unistd.h>
|
||||
#ifdef CONFIG_NXPLAYER_HTTP_STREAMING_SUPPORT
|
||||
# include <sys/time.h>
|
||||
@ -1900,7 +1901,7 @@ static int nxplayer_playinternal(FAR struct nxplayer_s *pplayer,
|
||||
goto err_out_nodev;
|
||||
}
|
||||
|
||||
for (c = 0; c < sizeof(g_dec_ops) / sizeof(g_dec_ops[0]); c++)
|
||||
for (c = 0; c < nitems(g_dec_ops); c++)
|
||||
{
|
||||
if (g_dec_ops[c].format == filefmt)
|
||||
{
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <nuttx/audio/audio.h>
|
||||
@ -157,8 +158,7 @@ static int nxplayer_parse_mpeg(uint32_t header, FAR uint32_t *samplerate,
|
||||
padding = (header >> 9) & 1;
|
||||
mode = (header >> 6) & 3;
|
||||
|
||||
if (sr_idx >= sizeof(g_mpa_freq_tab) / sizeof(g_mpa_freq_tab[0]) ||
|
||||
br_idx >= 0xf)
|
||||
if (sr_idx >= nitems(g_mpa_freq_tab) || br_idx >= 0xf)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -312,6 +312,6 @@ int main(int argc, FAR char *argv[])
|
||||
close(cfgs.fd);
|
||||
|
||||
out:
|
||||
arg_freetable((FAR void **)&args, sizeof(args) / sizeof(FAR void *));
|
||||
arg_freetable((FAR void **)&args, 1);
|
||||
return 0;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
@ -247,9 +248,7 @@ static int ubloxmodem_help(FAR struct ubloxmodem_cxt *cxt)
|
||||
|
||||
printf("Usage: ubloxmodem <cmd> [arguments]\n"
|
||||
" where <cmd> is one of\n");
|
||||
for (i = 0;
|
||||
i < sizeof(cmdmap) / sizeof(struct cmdinfo);
|
||||
i++)
|
||||
for (i = 0; i < nitems(cmdmap); i++)
|
||||
{
|
||||
printf("%s\n %s\n %s\n",
|
||||
cmdmap[i].name,
|
||||
@ -375,8 +374,7 @@ static int ubloxmodem_parse(FAR struct ubloxmodem_cxt *cxt)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0;
|
||||
i < sizeof(cmdmap) / sizeof(struct cmdinfo) &&
|
||||
for (i = 0; i < nitems(cmdmap) &&
|
||||
cxt->cmd == UBLOXMODEM_CMD_UNKNOWN;
|
||||
i++)
|
||||
{
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include "utility.h"
|
||||
|
||||
@ -89,7 +90,7 @@ static int pubsubtest_thread_entry(int argc, FAR char *argv[])
|
||||
|
||||
/* wait for up to 500ms for data */
|
||||
|
||||
pret = poll(&fds[0], (sizeof(fds) / sizeof(fds[0])), 500);
|
||||
pret = poll(&fds[0], nitems(fds), 500);
|
||||
if (fds[0].revents & POLLIN)
|
||||
{
|
||||
unsigned elt;
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/param.h>
|
||||
#include <crypto/cryptodev.h>
|
||||
#include <crypto/md5.h>
|
||||
#include <crypto/sha1.h>
|
||||
@ -192,7 +193,7 @@ int main(int argc, char *argv[])
|
||||
int ret;
|
||||
unsigned char out[64];
|
||||
|
||||
for (int i = 0; i < sizeof(testcase) / sizeof(struct tb); i++)
|
||||
for (int i = 0; i < nitems(testcase); i++)
|
||||
{
|
||||
ret = syscrypt(testcase[i].key, 16, testcase[i].iv, testcase[i].plain,
|
||||
out, testcase[i].len, 1);
|
||||
|
@ -351,7 +351,7 @@ int main(int argc, FAR char **argv)
|
||||
int fail = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (sizeof(tests) / sizeof(tests[0])); i++)
|
||||
for (i = 0; i < nitems(tests); i++)
|
||||
{
|
||||
fail += run(i);
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/param.h>
|
||||
#include <crypto/rijndael.h>
|
||||
#include <crypto/cryptodev.h>
|
||||
#include <err.h>
|
||||
@ -1727,7 +1728,6 @@ struct aes_xts_tv aes_xts_test_vectors[] =
|
||||
},
|
||||
},
|
||||
};
|
||||
#define N_VECTORS (sizeof(aes_xts_test_vectors) / sizeof(*aes_xts_test_vectors))
|
||||
|
||||
static int match(FAR unsigned char *a, FAR unsigned char *b, size_t len)
|
||||
{
|
||||
@ -1837,7 +1837,7 @@ int main(int argc, FAR char **argv)
|
||||
int fail = 0;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < N_VECTORS; i++)
|
||||
for (i = 0; i < nitems(aes_xts_test_vectors); i++)
|
||||
{
|
||||
tv = &aes_xts_test_vectors[i];
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/param.h>
|
||||
#include <crypto/cryptodev.h>
|
||||
#include <crypto/md5.h>
|
||||
#include <crypto/sha1.h>
|
||||
@ -329,7 +330,7 @@ int main(void)
|
||||
printf("syshash init failed\n");
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(md5_testcase) / sizeof(tb); i++)
|
||||
for (i = 0; i < nitems(md5_testcase); i++)
|
||||
{
|
||||
ret = syshash_start(&md5_ctx, CRYPTO_MD5);
|
||||
if (ret != 0)
|
||||
@ -365,7 +366,7 @@ int main(void)
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(sha_testcase) / sizeof(struct tb); i++)
|
||||
for (i = 0; i < nitems(sha_testcase); i++)
|
||||
{
|
||||
ret = syshash_start(&sha1_ctx, CRYPTO_SHA1);
|
||||
if (ret != 0)
|
||||
@ -420,7 +421,7 @@ int main(void)
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(sha_testcase) / sizeof(struct tb); i++)
|
||||
for (i = 0; i < nitems(sha_testcase); i++)
|
||||
{
|
||||
ret = syshash_start(&sha2_256_ctx, CRYPTO_SHA2_256);
|
||||
if (ret != 0)
|
||||
@ -473,7 +474,7 @@ int main(void)
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(sha512_testcase) / sizeof(struct tb); i++)
|
||||
for (i = 0; i < nitems(sha512_testcase); i++)
|
||||
{
|
||||
ret = syshash_start(&sha2_512_ctx, CRYPTO_SHA2_512);
|
||||
if (ret != 0)
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/param.h>
|
||||
#include <crypto/cryptodev.h>
|
||||
#include <crypto/md5.h>
|
||||
#include <crypto/sha1.h>
|
||||
@ -192,7 +193,7 @@ int main(void)
|
||||
{
|
||||
char output[32];
|
||||
int ret = 0;
|
||||
for (int i = 0; i < sizeof(testcase) / sizeof(struct tb); i++)
|
||||
for (int i = 0; i < nitems(testcase) i++)
|
||||
{
|
||||
ret += syshmac(CRYPTO_MD5_HMAC, testcase[i].key,
|
||||
testcase[i].keylen,
|
||||
@ -215,7 +216,7 @@ int main(void)
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < sizeof(testcase) / sizeof(struct tb); i++)
|
||||
for (int i = 0; i < nitems(testcase); i++)
|
||||
{
|
||||
ret = syshmac(CRYPTO_SHA1_HMAC, testcase[i].key,
|
||||
testcase[i].keylen,
|
||||
@ -238,7 +239,7 @@ int main(void)
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < sizeof(testcase) / sizeof(struct tb); i++)
|
||||
for (int i = 0; i < nitems(testcase); i++)
|
||||
{
|
||||
ret = syshmac(CRYPTO_SHA2_256_HMAC, testcase[i].key,
|
||||
testcase[i].keylen,
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -283,7 +284,7 @@ static void test_case_fb_2(FAR void **state)
|
||||
const uint32_t xres = fb_state->fb_info.video_info.xres;
|
||||
const uint32_t yres = fb_state->fb_info.video_info.yres;
|
||||
|
||||
step_num = sizeof(colors_to_show) / sizeof(uint32_t);
|
||||
step_num = nitems(colors_to_show);
|
||||
step_width = xres / step_num;
|
||||
for (i = 0; i < step_num; i++)
|
||||
{
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -342,7 +343,7 @@ static void test_case_lcd_2(FAR void **state)
|
||||
const uint32_t xres = lcd_state->lcd_info.video_info.xres;
|
||||
const uint32_t yres = lcd_state->lcd_info.video_info.yres;
|
||||
|
||||
step_num = sizeof(colors_to_show) / sizeof(uint32_t);
|
||||
step_num = nitems(colors_to_show);
|
||||
step_width = xres / step_num;
|
||||
for (i = 0; i < step_num; i++)
|
||||
{
|
||||
|
@ -61,6 +61,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
@ -78,8 +79,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ARRAYSIZE(a) (sizeof (a) / sizeof (a)[0])
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
@ -1152,7 +1151,7 @@ int main(int argc, FAR char *argv[])
|
||||
"assignments...\n",
|
||||
i ? 'f' : 's');
|
||||
|
||||
for (t = 0; t < ARRAYSIZE(test_data); ++t)
|
||||
for (t = 0; t < nitems(test_data); ++t)
|
||||
{
|
||||
/* Prefill the arguments with zeroes. */
|
||||
|
||||
@ -1329,7 +1328,7 @@ int main(int argc, FAR char *argv[])
|
||||
/* Test the char, short, and long specification-modifiers. */
|
||||
|
||||
printf("\nTesting scanf()'s type-modifiers...\n");
|
||||
for (t = 0; t < ARRAYSIZE(type_data); ++t)
|
||||
for (t = 0; t < nitems(type_data); ++t)
|
||||
{
|
||||
unsigned char hhu;
|
||||
unsigned short hu;
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/param.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <nuttx/sensors/sensor.h>
|
||||
@ -39,7 +40,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ARRAYSIZE(a) (sizeof(a) / sizeof(a)[0])
|
||||
#define DEVNAME_FMT "/dev/uorb/sensor_%s"
|
||||
#define DEVNAME_MAX 64
|
||||
|
||||
@ -317,7 +317,7 @@ int main(int argc, FAR char *argv[])
|
||||
if (optind < argc)
|
||||
{
|
||||
name = argv[optind];
|
||||
for (idx = 0; idx < ARRAYSIZE(g_sensor_info); idx++)
|
||||
for (idx = 0; idx < nitems(g_sensor_info); idx++)
|
||||
{
|
||||
if (!strncmp(name, g_sensor_info[idx].name,
|
||||
strlen(g_sensor_info[idx].name)))
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/param.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <nuttx/queue.h>
|
||||
@ -102,8 +103,6 @@ static const struct i8sak_command_s g_i8sak_commands[] =
|
||||
{"tx", (CODE void *)i8sak_tx_cmd},
|
||||
};
|
||||
|
||||
#define NCOMMANDS (sizeof(g_i8sak_commands) / sizeof(struct i8sak_command_s))
|
||||
|
||||
static sq_queue_t g_i8sak_free;
|
||||
static sq_queue_t g_i8sak_instances;
|
||||
static struct i8sak_s g_i8sak_pool[CONFIG_IEEE802154_I8SAK_NINSTANCES];
|
||||
@ -893,7 +892,7 @@ int main(int argc, FAR char *argv[])
|
||||
/* Find the command in the g_i8sak_command[] list */
|
||||
|
||||
i8sakcmd = NULL;
|
||||
for (i = 0; i < NCOMMANDS; i++)
|
||||
for (i = 0; i < nitems(g_i8sak_commands); i++)
|
||||
{
|
||||
FAR const struct i8sak_command_s *cmd = &g_i8sak_commands[i];
|
||||
if (strcmp(argv[argind], cmd->name) == 0)
|
||||
|
@ -22,6 +22,7 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -94,8 +95,6 @@ static const struct iwpan_command_s g_iwpan_commands[] =
|
||||
{"txpwr", 2, (CODE void *)iwpan_txpwr_cmd},
|
||||
};
|
||||
|
||||
#define NCOMMANDS (sizeof(g_iwpan_commands) / sizeof(struct iwpan_command_s))
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
@ -660,7 +659,7 @@ int main(int argc, FAR char *argv[])
|
||||
/* Find the command in the g_iwpan_command[] list */
|
||||
|
||||
iwpancmd = NULL;
|
||||
for (i = 0; i < NCOMMANDS; i++)
|
||||
for (i = 0; i < nitems(g_iwpan_commands); i++)
|
||||
{
|
||||
FAR const struct iwpan_command_s *cmd = &g_iwpan_commands[i];
|
||||
if (strcmp(cmdname, cmd->name) == 0)
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <strings.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
@ -137,8 +138,6 @@ static const struct wapi_command_s g_wapi_commands[] =
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define NCOMMANDS (sizeof(g_wapi_commands) / sizeof(struct wapi_command_s))
|
||||
|
||||
/* Maximum length of the PASSPHRASE, refer to IEEE802.11i specification */
|
||||
|
||||
#define PASSPHRASE_MAX_LEN (64)
|
||||
@ -1200,7 +1199,7 @@ int main(int argc, FAR char *argv[])
|
||||
/* Find the command in the g_wapi_command[] list */
|
||||
|
||||
wapicmd = NULL;
|
||||
for (i = 0; i < NCOMMANDS; i++)
|
||||
for (i = 0; i < nitems(g_wapi_commands); i++)
|
||||
{
|
||||
FAR const struct wapi_command_s *cmd = &g_wapi_commands[i];
|
||||
if (strcmp(cmdname, cmd->name) == 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user