diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2018-10-15 14:15:11 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2018-10-15 14:15:11 +0200 |
commit | 8729c86f595b963992109f86e0389a1613aeb649 (patch) | |
tree | ca6c2476511f8e207262675e1e60be9f02e8b590 /virtiotest.c | |
parent | ac08d0891a969acc5d4a2f9b0ce56e75dc565f59 (diff) | |
download | drminfo-8729c86f595b963992109f86e0389a1613aeb649.tar.gz |
ARRAY_SIZE
Diffstat (limited to 'virtiotest.c')
-rw-r--r-- | virtiotest.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/virtiotest.c b/virtiotest.c index bd87073..ecbe283 100644 --- a/virtiotest.c +++ b/virtiotest.c @@ -20,6 +20,10 @@ /* ------------------------------------------------------------------ */ +#define ARRAY_SIZE(_x) (sizeof(_x)/sizeof(_x[0])) + +/* ------------------------------------------------------------------ */ + static struct { uint64_t cap; const char *name; @@ -53,7 +57,7 @@ static void virtio_print_caps(void) int i; printf("virtio capabilities\n"); - for (i = 0; i < sizeof(virtio_caps)/sizeof(virtio_caps[0]); i++) { + for (i = 0; i < ARRAY_SIZE(virtio_caps); i++) { value = virtio_get_cap(virtio_caps[i].cap); printf(" %s: %" PRId64 "\n", virtio_caps[i].name, value); } |