summaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2012-10-16 21:09:33 +0200
committerRan Benita <ran234@gmail.com>2012-10-16 21:31:25 +0200
commit179855116d15b9da939f8fa397cd6e4399d96b39 (patch)
tree66a5646d04b12f47c23324878e854f93637b6fee /src/utils.h
parent7b3bd11f92f0bed76f25eab8c79c0eca21e037bc (diff)
utils: add and use ARRAY_SIZE macro
Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h2
1 files changed, 2 insertions, 0 deletions
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))