lvgldemo: use nitems instead of sizeof
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
parent
6b44c59bee
commit
e86745b9a2
@ -25,6 +25,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <sys/boardctl.h>
|
#include <sys/boardctl.h>
|
||||||
|
#include <sys/param.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -113,8 +114,7 @@ static const struct func_key_pair_s func_key_pair[] =
|
|||||||
static void show_usage(void)
|
static void show_usage(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const int len = sizeof(func_key_pair)
|
const int len = nitems(func_key_pair) - 1;
|
||||||
/ sizeof(struct func_key_pair_s) - 1;
|
|
||||||
|
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
{
|
{
|
||||||
@ -141,8 +141,7 @@ static void show_usage(void)
|
|||||||
static demo_create_func_t find_demo_create_func(FAR const char *name)
|
static demo_create_func_t find_demo_create_func(FAR const char *name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const int len = sizeof(func_key_pair)
|
const int len = nitems(func_key_pair) - 1;
|
||||||
/ sizeof(struct func_key_pair_s) - 1;
|
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
@ -177,8 +176,7 @@ int main(int argc, FAR char *argv[])
|
|||||||
{
|
{
|
||||||
demo_create_func_t demo_create_func;
|
demo_create_func_t demo_create_func;
|
||||||
FAR const char *demo = NULL;
|
FAR const char *demo = NULL;
|
||||||
const int func_key_pair_len = sizeof(func_key_pair) /
|
const int func_key_pair_len = nitems(func_key_pair);
|
||||||
sizeof(func_key_pair[0]);
|
|
||||||
|
|
||||||
#ifdef CONFIG_LIBUV
|
#ifdef CONFIG_LIBUV
|
||||||
uv_loop_t ui_loop;
|
uv_loop_t ui_loop;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user