utils: move ARRAY_SIZE from uloop to utils.h
[project/libubox.git] / utils.h
diff --git a/utils.h b/utils.h
index e56998d..065a28b 100644 (file)
--- a/utils.h
+++ b/utils.h
@@ -34,4 +34,8 @@
 
 void *__calloc_a(size_t len, ...);
 
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#endif
+
 #endif