Add general purpose `ARRAY_SIZE` macro

This commit adds `ARRAY_SIZE` as an helper for determining the number of
elements in an initialized array. The calculation is the same but the
macro provides a convenient shortcut. The implementation was borrowed
from the kernel sources.
pull/4383/head
Jeff Lucovsky 7 years ago committed by Victor Julien
parent ae198add6d
commit 90c2e3561c

@ -494,5 +494,8 @@ char *strptime(const char * __restrict, const char * __restrict, struct tm * __r
extern int coverage_unittests;
extern int g_ut_modules;
extern int g_ut_covered;
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
#endif /* __SURICATA_COMMON_H__ */

Loading…
Cancel
Save