summaryrefslogtreecommitdiff
path: root/tests/test-visitor-serialization.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-visitor-serialization.c')
-rw-r--r--tests/test-visitor-serialization.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/tests/test-visitor-serialization.c b/tests/test-visitor-serialization.c
index 8166cf1b0..7ad188639 100644
--- a/tests/test-visitor-serialization.c
+++ b/tests/test-visitor-serialization.c
@@ -195,13 +195,29 @@ typedef struct TestStruct
static void visit_type_TestStruct(Visitor *v, TestStruct **obj,
const char *name, Error **errp)
{
- visit_start_struct(v, (void **)obj, NULL, name, sizeof(TestStruct), errp);
+ Error *err = NULL;
- visit_type_int(v, &(*obj)->integer, "integer", errp);
- visit_type_bool(v, &(*obj)->boolean, "boolean", errp);
- visit_type_str(v, &(*obj)->string, "string", errp);
+ visit_start_struct(v, (void **)obj, NULL, name, sizeof(TestStruct), &err);
+ if (err) {
+ goto out;
+ }
- visit_end_struct(v, errp);
+ visit_type_int(v, &(*obj)->integer, "integer", &err);
+ if (err) {
+ goto out_end;
+ }
+ visit_type_bool(v, &(*obj)->boolean, "boolean", &err);
+ if (err) {
+ goto out_end;
+ }
+ visit_type_str(v, &(*obj)->string, "string", &err);
+
+out_end:
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_struct(v, &err);
+out:
+ error_propagate(errp, err);
}
static TestStruct *struct_create(void)
@@ -356,8 +372,8 @@ static void test_primitive_lists(gconstpointer opaque)
TestArgs *args = (TestArgs *) opaque;
const SerializeOps *ops = args->ops;
PrimitiveType *pt = args->test_data;
- PrimitiveList pl = { .value = { 0 } };
- PrimitiveList pl_copy = { .value = { 0 } };
+ PrimitiveList pl = { .value = { NULL } };
+ PrimitiveList pl_copy = { .value = { NULL } };
PrimitiveList *pl_copy_ptr = &pl_copy;
Error *err = NULL;
void *serialize_data;
@@ -755,7 +771,7 @@ static void test_nested_struct_list(gconstpointer opaque)
g_free(args);
}
-PrimitiveType pt_values[] = {
+static PrimitiveType pt_values[] = {
/* string tests */
{
.description = "string_empty",