tests/tests.h: add ARRAY_SIZE and LENGTH_OF macros

* tests/tests.h (ARRAY_SIZE, LENGTH_OF): New macros.
* tests/aio.c (ARRAY_SIZE): Remove.
* tests/mmsg.c (LENGTH_OF): Remove.
This commit is contained in:
Дмитрий Левин 2016-01-20 05:08:04 +00:00
parent 590b240444
commit a5417308e4
3 changed files with 3 additions and 4 deletions

View File

@ -42,8 +42,6 @@
&& defined __NR_io_destroy
# include <linux/aio_abi.h>
# define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
int
main(void)
{

View File

@ -45,8 +45,6 @@ struct mmsghdr {
};
# endif
# define LENGTH_OF(arg) ((unsigned int) sizeof(arg) - 1)
static int
send_mmsg(int fd, struct mmsghdr *vec, unsigned int vlen, unsigned int flags)
{

View File

@ -66,6 +66,9 @@ void tprintf(const char *, ...)
/* Make a hexdump copy of C string */
const char *hexdump_strdup(const char *);
# define ARRAY_SIZE(arg) ((unsigned int) (sizeof(arg) / sizeof((arg)[0])))
# define LENGTH_OF(arg) ((unsigned int) sizeof(arg) - 1)
# define SKIP_MAIN_UNDEFINED(arg) \
int main(void) { error_msg_and_skip("undefined: %s", arg); }