[diag] use OT_ARRAY_LENGTH to unify code and shrink image size (#3677)

This commit is contained in:
Yuzhuo Yang
2019-04-03 21:52:07 -07:00
committed by Jonathan Hui
parent 6dc3b28b3f
commit c02a985609
4 changed files with 21 additions and 12 deletions
+10
View File
@@ -71,4 +71,14 @@
} \
} while (0)
/**
* This macro calculates the number of elements in an array.
*
* @param[in] aArray Name of the array variable.
*
* @returns Number of elements in the array.
*
*/
#define otARRAY_LENGTH(aArray) (sizeof(aArray) / sizeof(aArray[0]))
#endif // CODE_UTILS_H