From 179855116d15b9da939f8fa397cd6e4399d96b39 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 16 Oct 2012 21:09:33 +0200 Subject: utils: add and use ARRAY_SIZE macro Signed-off-by: Ran Benita --- src/utils.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/utils.h') diff --git a/src/utils.h b/src/utils.h index 55ff61c..b4daadd 100644 --- a/src/utils.h +++ b/src/utils.h @@ -91,6 +91,8 @@ memdup(const void *mem, size_t nmemb, size_t size) return p; } +#define ARRAY_SIZE(arr) ((sizeof(arr) / sizeof(*(arr)))) + #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MIN3(a, b, c) MIN(MIN((a), (b)), (c)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) -- cgit v1.2.3