summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfonso Sánchez-Beato <alfonso.sanchez-beato@canonical.com>2021-09-23 09:12:49 +0200
committerRay Strode <halfline@gmail.com>2021-09-27 10:03:53 +0000
commita4a1afc83f94acf48fffb706e3dc326f45209721 (patch)
treebeb7aae4daa024f023b9e5b449c5ad2c34894bb1
parent4bf060c5dd055bb954e8e1ad262da56694316e88 (diff)
ply-utils: add macro to count the number of elements in an array
-rw-r--r--src/libply/ply-utils.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libply/ply-utils.h b/src/libply/ply-utils.h
index d7b76221..47bb3f24 100644
--- a/src/libply/ply-utils.h
+++ b/src/libply/ply-utils.h
@@ -39,6 +39,8 @@
#define CLAMP(a, b, c) (MIN (MAX ((a), (b)), (c)))
#endif
+#define PLY_NUMBER_OF_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0]))
+
#define PLY_UTF8_CHARACTER_SIZE_MAX 4
typedef intptr_t ply_module_handle_t;