[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-trivial] [PATCH 1/2] hw/virtio-net: use existing macros to impleme
From: |
Jesse Larrew |
Subject: |
[Qemu-trivial] [PATCH 1/2] hw/virtio-net: use existing macros to implement endof |
Date: |
Thu, 7 Feb 2013 14:49:26 -0600 |
Clarify the definition of endof() by using the offsetof() and sizeof()
macros to handle the pointer magic.
Signed-off-by: Jesse Larrew <address@hidden>
---
hw/virtio-net.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 8f521b3..663f33c 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -81,7 +81,7 @@ typedef struct VirtIONet
* 'container'.
*/
#define endof(container, field) \
- ((intptr_t)(&(((container *)0)->field)+1))
+ (offsetof(container, field) + sizeof(((container *)0)->field))
typedef struct VirtIOFeature {
uint32_t flags;
--
1.7.11.7