[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:
Abtin Keshavarzian
2018-05-29 15:53:53 -07:00
committed by Jonathan Hui
parent ae7984d3a7
commit 2abd7a2822
16 changed files with 61 additions and 61 deletions
+2 -1
View File
@@ -32,6 +32,7 @@
#include <openthread/openthread.h>
#include "test_util.h"
#include "common/code_utils.hpp"
#include "common/instance.hpp"
#include "thread/topology.hpp"
@@ -132,7 +133,7 @@ void TestChildIp6Address(void)
numAddresses++;
for (uint8_t index = 0; index < static_cast<uint8_t>(sizeof(ip6Addresses) / sizeof(ip6Addresses[0])); index++)
for (uint8_t index = 0; index < static_cast<uint8_t>(OT_ARRAY_LENGTH(ip6Addresses)); index++)
{
VerifyOrQuit(numAddresses < kMaxChildIp6Addresses, "Too many IPv6 addresses in the unit test");
SuccessOrQuit(addresses[numAddresses++].FromString(ip6Addresses[index]),