]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virjsontest: Replace virJSONValueObjectCreate by virJSONValueObjectAdd
authorPeter Krempa <pkrempa@redhat.com>
Mon, 8 Nov 2021 16:24:50 +0000 (17:24 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 17 Nov 2021 11:04:11 +0000 (12:04 +0100)
virJSONValueObjectAdd now works identically to virJSONValueObjectCreate
when used with a NULL argument. Replace all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/virjsontest.c

index 5e26de1f220ecb6c5e27b57a9535852e9c9ac55f..ddb93803b78d50b6b864da9caa43802a5ebd3ba3 100644 (file)
@@ -391,10 +391,10 @@ testJSONEscapeObj(const void *data G_GNUC_UNUSED)
     g_autofree char *result = NULL;
     const char *parsednestedstr;
 
-    if (virJSONValueObjectCreate(&nestjson,
-                                 "s:stringkey", "stringvalue",
-                                 "i:numberkey", 1234,
-                                 "b:booleankey", false, NULL) < 0) {
+    if (virJSONValueObjectAdd(&nestjson,
+                              "s:stringkey", "stringvalue",
+                              "i:numberkey", 1234,
+                              "b:booleankey", false, NULL) < 0) {
         VIR_TEST_VERBOSE("failed to create nested json object");
         return -1;
     }
@@ -404,7 +404,7 @@ testJSONEscapeObj(const void *data G_GNUC_UNUSED)
         return -1;
     }
 
-    if (virJSONValueObjectCreate(&json, "s:test", neststr, NULL) < 0) {
+    if (virJSONValueObjectAdd(&json, "s:test", neststr, NULL) < 0) {
         VIR_TEST_VERBOSE("Failed to create json object");
         return -1;
     }
@@ -446,8 +446,8 @@ testJSONObjectFormatSteal(const void *opaque G_GNUC_UNUSED)
         VIR_TEST_VERBOSE("Failed to create json object");
     }
 
-    if (virJSONValueObjectCreate(&t1, "a:t", &a1, "s:f", NULL, NULL) != -1) {
-        VIR_TEST_VERBOSE("virJSONValueObjectCreate(t1) should have failed");
+    if (virJSONValueObjectAdd(&t1, "a:t", &a1, "s:f", NULL, NULL) != -1) {
+        VIR_TEST_VERBOSE("virJSONValueObjectAdd(t1) should have failed");
         return -1;
     }
 
@@ -456,8 +456,8 @@ testJSONObjectFormatSteal(const void *opaque G_GNUC_UNUSED)
         return -1;
     }
 
-    if (virJSONValueObjectCreate(&t2, "s:f", NULL, "a:t", &a1, NULL) != -1) {
-        VIR_TEST_VERBOSE("virJSONValueObjectCreate(t2) should have failed");
+    if (virJSONValueObjectAdd(&t2, "s:f", NULL, "a:t", &a1, NULL) != -1) {
+        VIR_TEST_VERBOSE("virJSONValueObjectAdd(t2) should have failed");
         return -1;
     }