Commit 49778862 authored by Alejandro Mery's avatar Alejandro Mery
Browse files

common: add ARRAY_SIZE() macro

parent e36d3866
......@@ -32,6 +32,11 @@
#define container_of(P,T,M) (T *)((char *)(P) - offsetof(T, M))
#endif
/** calculate number of elements of an array */
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(A) (sizeof(A)/sizeof((A)[0]))
#endif
/** shortcut to printf to stderr */
#define errf(...) fprintf(stderr, __VA_ARGS__)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment