From patchwork Mon Oct 19 18:42:53 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [08/25] vmstate: factor vmstate_offset_pointer Date: Mon, 19 Oct 2009 08:42:53 -0000 From: Juan Quintela X-Patchwork-Id: 36399 Message-Id: To: qemu-devel@nongnu.org Signed-off-by: Juan Quintela --- hw/hw.h | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/hw.h b/hw/hw.h index d1395e9..a331844 100644 --- a/hw/hw.h +++ b/hw/hw.h @@ -342,6 +342,10 @@ extern const VMStateInfo vmstate_info_buffer; (offsetof(_state, _field) + \ type_check(_type, typeof_field(_state, _field))) +#define vmstate_offset_pointer(_state, _field, _type) \ + (offsetof(_state, _field) + \ + type_check_pointer(_type, typeof_field(_state, _field))) + #define VMSTATE_SINGLE(_field, _state, _version, _info, _type) { \ .name = (stringify(_field)), \ .version_id = (_version), \ @@ -398,8 +402,7 @@ extern const VMStateInfo vmstate_info_buffer; .info = &(_info), \ .size = sizeof(_type), \ .flags = VMS_VARRAY_INT32|VMS_POINTER, \ - .offset = offsetof(_state, _field) \ - + type_check_pointer(_type,typeof_field(_state, _field)) \ + .offset = vmstate_offset_pointer(_state, _field, _type), \ } #define VMSTATE_STRUCT(_field, _state, _version, _vmsd, _type) { \