Remove unused _V version. Signed-off-by: Juan Quintela <quint...@redhat.com> --- include/migration/vmstate.h | 9 +++------ tests/test-vmstate.c | 28 ++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 378dbc9..eeff224 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -639,21 +639,18 @@ extern const VMStateInfo vmstate_info_bitmap; #define VMSTATE_FLOAT64_ARRAY(_f, _s, _n) \ VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_float64, float64) +#define VMSTATE_UINT8_2DARRAY(_f, _s, _n1, _n2) \ + VMSTATE_2DARRAY(_f, _s, _n1, _n2, 0, vmstate_info_uint8, uint8_t) + #define VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, _v) \ VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint16, uint16_t) #define VMSTATE_UINT16_2DARRAY(_f, _s, _n1, _n2) \ VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, 0) -#define VMSTATE_UINT8_2DARRAY_V(_f, _s, _n1, _n2, _v) \ - VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint8, uint8_t) - #define VMSTATE_UINT8_SUB_ARRAY(_f, _s, _start, _num) \ VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint8, uint8_t) -#define VMSTATE_UINT8_2DARRAY(_f, _s, _n1, _n2) \ - VMSTATE_UINT8_2DARRAY_V(_f, _s, _n1, _n2, 0) - #define VMSTATE_UINT32_2DARRAY_V(_f, _s, _n1, _n2, _v) \ VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint32, uint32_t) diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c index 9addb60..6c01832 100644 --- a/tests/test-vmstate.c +++ b/tests/test-vmstate.c @@ -507,6 +507,7 @@ static void test_simple_bitmap(void) } #define VMSTATE_ARRAY_SIZE 5 +#define VMSTATE_2D_SIZE 3 typedef struct TestArray { int32_t size; @@ -524,6 +525,7 @@ typedef struct TestArray { int32_t i32_2[VMSTATE_ARRAY_SIZE]; int64_t i64_1[VMSTATE_ARRAY_SIZE]; float64 f64_1[VMSTATE_ARRAY_SIZE]; + uint8_t u8_1d[VMSTATE_2D_SIZE][VMSTATE_2D_SIZE]; } TestArray; TestArray obj_array = { @@ -543,6 +545,9 @@ TestArray obj_array = { .i64_1 = {61, 62, 63, 64, 65}, .f64_1 = {float64_zero, float64_one, float64_ln2, float64_pi, float64_infinity}, + .u8_1d = { {71, 72, 73}, + {74, 75, 76}, + {77, 78, 79} }, }; static const VMStateDescription vmstate_array_primitive = { @@ -561,6 +566,8 @@ static const VMStateDescription vmstate_array_primitive = { VMSTATE_INT32_ARRAY(i32_1, TestArray, VMSTATE_ARRAY_SIZE), VMSTATE_INT64_ARRAY(i64_1, TestArray, VMSTATE_ARRAY_SIZE), VMSTATE_FLOAT64_ARRAY(f64_1, TestArray, VMSTATE_ARRAY_SIZE), + VMSTATE_UINT8_2DARRAY(u8_1d, TestArray, VMSTATE_2D_SIZE, + VMSTATE_2D_SIZE), VMSTATE_END_OF_LIST() } }; @@ -592,6 +599,9 @@ uint8_t wire_array_primitive[] = { 0x3f, 0xe6, 0x2e, 0x42, 0xfe, 0xfa, 0x39, 0xef, 0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* u8_1d */ 0x47, 0x48, 0x49, + 0x4a, 0x4b, 0x4c, + 0x4d, 0x4e, 0x4f, QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */ }; @@ -599,7 +609,7 @@ static void obj_array_copy(void *arg1, void *arg2) { TestArray *target = arg1; TestArray *source = arg2; - int i; + int i, j; target->size = source->size; @@ -619,12 +629,18 @@ static void obj_array_copy(void *arg1, void *arg2) target->i64_1[i] = source->i64_1[i]; target->f64_1[i] = source->f64_1[i]; } + + for (i = 0; i < VMSTATE_2D_SIZE; i++) { + for (j = 0; j < VMSTATE_2D_SIZE; j++) { + target->u8_1d[i][j] = source->u8_1d[i][j]; + } + } } static void test_array_primitive(void) { TestArray obj, obj_clone; - int i; + int i, j; memset(&obj, 0, sizeof(obj)); obj.size = VMSTATE_ARRAY_SIZE; @@ -640,6 +656,8 @@ static void test_array_primitive(void) #define FIELD_EQUAL(name) g_assert_cmpint(obj.name, ==, obj_array.name) #define ELEM_EQUAL(name, i) \ g_assert_cmpint(obj.name[i], ==, obj_array.name[i]) +#define ELEM_EQUAL_2D(name, i, j) \ + g_assert_cmpint(obj.name[i][j], ==, obj_array.name[i][j]) #define ELEM_NOT_EQUAL(name, i) \ g_assert_cmpint(obj.name[i], !=, obj_array.name[i]) @@ -656,6 +674,11 @@ static void test_array_primitive(void) ELEM_EQUAL(i64_1, i); ELEM_EQUAL(f64_1, i); } + for (i = 0; i < VMSTATE_2D_SIZE; i++) { + for (j = 0; j < VMSTATE_2D_SIZE; j++) { + ELEM_EQUAL_2D(u8_1d, i, j); + } + } } static const VMStateDescription vmstate_array_test = { @@ -729,6 +752,7 @@ static void test_array_test(void) } #undef FIELD_EQUAL #undef ELEM_EQUAL +#undef ELEM_EQUAL_2D #undef ELEM_NOT_EQUAL typedef struct TestVersioned { -- 1.9.0