Add NITEMS(arr) to get the number of elements of an array
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
parent
220b352b70
commit
eb164165f6
@ -171,6 +171,8 @@ static inline void memzero(void *ptr, size_t size)
|
|||||||
#define SCALE DAY
|
#define SCALE DAY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define NITEMS(arr) (sizeof((arr)) / sizeof((arr)[0]))
|
||||||
|
|
||||||
/* Copy string pointed by B to array A with size checking. It was originally
|
/* Copy string pointed by B to array A with size checking. It was originally
|
||||||
in lmain.c but is _very_ useful elsewhere. Some setuid root programs with
|
in lmain.c but is _very_ useful elsewhere. Some setuid root programs with
|
||||||
very sloppy coding used to assume that BUFSIZ will always be enough... */
|
very sloppy coding used to assume that BUFSIZ will always be enough... */
|
||||||
|
Loading…
Reference in New Issue
Block a user