Mercurial > molko
diff src/util.h @ 47:f053a9f38c0e
core: implement basic scrolling, closes #2459
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 16 Jan 2020 13:32:20 +0100 |
parents | 9d1421c09dfb |
children |
line wrap: on
line diff
--- a/src/util.h Wed Jan 15 22:31:17 2020 +0100 +++ b/src/util.h Thu Jan 16 13:32:20 2020 +0100 @@ -22,6 +22,14 @@ #include <stddef.h> /** + * Get the number of elements in a static array. + * + * \param x the array + * \return the number of elements + */ +#define nelem(x) sizeof ((x)) / sizeof ((x)[0]) + +/** * Wrapper around malloc(3) that exits on allocation failure. * * \param size the size