mirror of
https://github.com/espressif/openthread.git
synced 2026-08-04 18:07:47 +00:00
[code-utils] adding helper macro OT_ARRAY_LENGTH() (#2743)
This commit adds helper macro `OT_ARRAY_LENGTH()` to get the number of elements in an array.
This commit is contained in:
committed by
Jonathan Hui
parent
ae7984d3a7
commit
2abd7a2822
@@ -28,6 +28,7 @@
|
||||
|
||||
#include <openthread/config.h>
|
||||
|
||||
#include "common/code_utils.hpp"
|
||||
#include "common/instance.hpp"
|
||||
#include "thread/network_data_local.hpp"
|
||||
|
||||
@@ -108,7 +109,7 @@ void TestNetworkDataIterator(void)
|
||||
printf("\nTest #1: Network data 1");
|
||||
printf("\n-------------------------------------------------");
|
||||
|
||||
for (uint8_t i = 0; i < sizeof(routes) / sizeof(routes[0]); i++)
|
||||
for (uint8_t i = 0; i < OT_ARRAY_LENGTH(routes); i++)
|
||||
{
|
||||
SuccessOrQuit(netData.GetNextExternalRoute(&iter, &config), "GetNextExternalRoute() failed\n");
|
||||
PrintExternalRouteConfig(config);
|
||||
@@ -158,7 +159,7 @@ void TestNetworkDataIterator(void)
|
||||
printf("\nTest #2: Network data 2");
|
||||
printf("\n-------------------------------------------------");
|
||||
|
||||
for (uint8_t i = 0; i < sizeof(routes) / sizeof(routes[0]); i++)
|
||||
for (uint8_t i = 0; i < OT_ARRAY_LENGTH(routes); i++)
|
||||
{
|
||||
SuccessOrQuit(netData.GetNextExternalRoute(&iter, &config), "GetNextExternalRoute() failed\n");
|
||||
PrintExternalRouteConfig(config);
|
||||
|
||||
Reference in New Issue
Block a user