]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
ply-utils: add macro to count the number of elements in an array
authorAlfonso Sánchez-Beato <alfonso.sanchez-beato@canonical.com>
Thu, 23 Sep 2021 07:12:49 +0000 (09:12 +0200)
committerRay Strode <halfline@gmail.com>
Mon, 27 Sep 2021 10:03:53 +0000 (10:03 +0000)
src/libply/ply-utils.h

index d7b76221a0781222831304daebfd797eb1addc78..47bb3f247b0cf36c6778db6b214f076e4b375940 100644 (file)
@@ -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;