aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ahci-test.c6
-rw-r--r--tests/check-qdict.c100
-rw-r--r--tests/check-qjson.c84
-rw-r--r--tests/check-qlist.c8
-rw-r--r--tests/check-qlit.c10
-rw-r--r--tests/check-qnull.c10
-rw-r--r--tests/check-qnum.c28
-rw-r--r--tests/check-qobject.c2
-rw-r--r--tests/check-qstring.c10
-rw-r--r--tests/cpu-plug-test.c4
-rw-r--r--tests/device-introspect-test.c24
-rw-r--r--tests/drive_del-test.c4
-rw-r--r--tests/libqos/libqos.c8
-rw-r--r--tests/libqos/pci-pc.c2
-rw-r--r--tests/libqtest.c24
-rw-r--r--tests/machine-none-test.c2
-rw-r--r--tests/migration-test.c26
-rw-r--r--tests/numa-test.c16
-rw-r--r--tests/pvpanic-test.c2
-rw-r--r--tests/q35-test.c2
-rw-r--r--tests/qmp-test.c38
-rw-r--r--tests/qom-test.c8
-rw-r--r--tests/tco-test.c12
-rw-r--r--tests/test-char.c2
-rw-r--r--tests/test-keyval.c82
-rw-r--r--tests/test-netfilter.c26
-rw-r--r--tests/test-qemu-opts.c14
-rw-r--r--tests/test-qga.c76
-rw-r--r--tests/test-qmp-cmds.c24
-rw-r--r--tests/test-qmp-event.c2
-rw-r--r--tests/test-qobject-input-visitor.c10
-rw-r--r--tests/test-qobject-output-visitor.c18
-rw-r--r--tests/test-visitor-serialization.c6
-rw-r--r--tests/test-x86-cpuid-compat.c14
-rw-r--r--tests/tmp105-test.c4
-rw-r--r--tests/vhost-user-test.c6
-rw-r--r--tests/virtio-net-test.c6
-rw-r--r--tests/vmgenid-test.c2
-rw-r--r--tests/wdt_ib700-test.c14
39 files changed, 368 insertions, 368 deletions
diff --git a/tests/ahci-test.c b/tests/ahci-test.c
index fb3cd84..1a7b761 100644
--- a/tests/ahci-test.c
+++ b/tests/ahci-test.c
@@ -1566,7 +1566,7 @@ static void atapi_wait_tray(bool open)
} else {
g_assert(!qdict_get_bool(data, "tray-open"));
}
- QDECREF(rsp);
+ qobject_unref(rsp);
}
static void test_atapi_tray(void)
@@ -1596,7 +1596,7 @@ static void test_atapi_tray(void)
"'arguments': {'id': 'cd0'}}");
atapi_wait_tray(true);
rsp = qmp_receive();
- QDECREF(rsp);
+ qobject_unref(rsp);
qmp_discard_response("{'execute': 'blockdev-remove-medium', "
"'arguments': {'id': 'cd0'}}");
@@ -1623,7 +1623,7 @@ static void test_atapi_tray(void)
"'arguments': {'id': 'cd0'}}");
atapi_wait_tray(false);
rsp = qmp_receive();
- QDECREF(rsp);
+ qobject_unref(rsp);
/* Now, to convince ATAPI we understand the media has changed... */
ahci_atapi_test_ready(ahci, port, false, SENSE_NOT_READY);
diff --git a/tests/check-qdict.c b/tests/check-qdict.c
index 07bb8f4..eba5d35 100644
--- a/tests/check-qdict.c
+++ b/tests/check-qdict.c
@@ -34,7 +34,7 @@ static void qdict_new_test(void)
g_assert(qdict->base.refcnt == 1);
g_assert(qobject_type(QOBJECT(qdict)) == QTYPE_QDICT);
- QDECREF(qdict);
+ qobject_unref(qdict);
}
static void qdict_put_obj_test(void)
@@ -54,7 +54,7 @@ static void qdict_put_obj_test(void)
qn = qobject_to(QNum, ent->value);
g_assert_cmpint(qnum_get_int(qn), ==, num);
- QDECREF(qdict);
+ qobject_unref(qdict);
}
static void qdict_destroy_simple_test(void)
@@ -65,7 +65,7 @@ static void qdict_destroy_simple_test(void)
qdict_put_int(qdict, "num", 0);
qdict_put_str(qdict, "str", "foo");
- QDECREF(qdict);
+ qobject_unref(qdict);
}
static void qdict_get_test(void)
@@ -84,7 +84,7 @@ static void qdict_get_test(void)
qn = qobject_to(QNum, obj);
g_assert_cmpint(qnum_get_int(qn), ==, value);
- QDECREF(tests_dict);
+ qobject_unref(tests_dict);
}
static void qdict_get_int_test(void)
@@ -99,7 +99,7 @@ static void qdict_get_int_test(void)
ret = qdict_get_int(tests_dict, key);
g_assert(ret == value);
- QDECREF(tests_dict);
+ qobject_unref(tests_dict);
}
static void qdict_get_try_int_test(void)
@@ -121,7 +121,7 @@ static void qdict_get_try_int_test(void)
ret = qdict_get_try_int(tests_dict, "string", -42);
g_assert_cmpuint(ret, ==, -42);
- QDECREF(tests_dict);
+ qobject_unref(tests_dict);
}
static void qdict_get_str_test(void)
@@ -137,7 +137,7 @@ static void qdict_get_str_test(void)
g_assert(p != NULL);
g_assert(strcmp(p, str) == 0);
- QDECREF(tests_dict);
+ qobject_unref(tests_dict);
}
static void qdict_get_try_str_test(void)
@@ -153,7 +153,7 @@ static void qdict_get_try_str_test(void)
g_assert(p != NULL);
g_assert(strcmp(p, str) == 0);
- QDECREF(tests_dict);
+ qobject_unref(tests_dict);
}
static void qdict_defaults_test(void)
@@ -174,8 +174,8 @@ static void qdict_defaults_test(void)
qdict_copy_default(copy, dict, "bar");
g_assert_cmpstr(qdict_get_str(copy, "bar"), ==, "xyz");
- QDECREF(copy);
- QDECREF(dict);
+ qobject_unref(copy);
+ qobject_unref(dict);
}
static void qdict_haskey_not_test(void)
@@ -183,7 +183,7 @@ static void qdict_haskey_not_test(void)
QDict *tests_dict = qdict_new();
g_assert(qdict_haskey(tests_dict, "test") == 0);
- QDECREF(tests_dict);
+ qobject_unref(tests_dict);
}
static void qdict_haskey_test(void)
@@ -194,7 +194,7 @@ static void qdict_haskey_test(void)
qdict_put_int(tests_dict, key, 0);
g_assert(qdict_haskey(tests_dict, key) == 1);
- QDECREF(tests_dict);
+ qobject_unref(tests_dict);
}
static void qdict_del_test(void)
@@ -210,7 +210,7 @@ static void qdict_del_test(void)
g_assert(qdict_size(tests_dict) == 0);
g_assert(qdict_haskey(tests_dict, key) == 0);
- QDECREF(tests_dict);
+ qobject_unref(tests_dict);
}
static void qobject_to_qdict_test(void)
@@ -218,7 +218,7 @@ static void qobject_to_qdict_test(void)
QDict *tests_dict = qdict_new();
g_assert(qobject_to(QDict, QOBJECT(tests_dict)) == tests_dict);
- QDECREF(tests_dict);
+ qobject_unref(tests_dict);
}
static void qdict_iterapi_test(void)
@@ -250,7 +250,7 @@ static void qdict_iterapi_test(void)
g_assert(count == qdict_size(tests_dict));
- QDECREF(tests_dict);
+ qobject_unref(tests_dict);
}
static void qdict_flatten_test(void)
@@ -325,7 +325,7 @@ static void qdict_flatten_test(void)
g_assert(qdict_size(dict3) == 8);
- QDECREF(dict3);
+ qobject_unref(dict3);
}
static void qdict_array_split_test(void)
@@ -390,31 +390,31 @@ static void qdict_array_split_test(void)
g_assert(int1);
g_assert(qlist_empty(test_list));
- QDECREF(test_list);
+ qobject_unref(test_list);
g_assert(qdict_get_int(dict1, "a") == 42);
g_assert(qdict_get_int(dict1, "b") == 23);
g_assert(qdict_size(dict1) == 2);
- QDECREF(dict1);
+ qobject_unref(dict1);
g_assert(qdict_get_int(dict2, "x") == 0);
g_assert(qdict_size(dict2) == 1);
- QDECREF(dict2);
+ qobject_unref(dict2);
g_assert_cmpint(qnum_get_int(int1), ==, 66);
- QDECREF(int1);
+ qobject_unref(int1);
g_assert(qdict_get_int(test_dict, "4.y") == 1);
g_assert(qdict_get_int(test_dict, "o.o") == 7);
g_assert(qdict_size(test_dict) == 2);
- QDECREF(test_dict);
+ qobject_unref(test_dict);
/*
* Test the split of
@@ -455,18 +455,18 @@ static void qdict_array_split_test(void)
g_assert(int1);
g_assert(qlist_empty(test_list));
- QDECREF(test_list);
+ qobject_unref(test_list);
g_assert_cmpint(qnum_get_int(int1), ==, 42);
- QDECREF(int1);
+ qobject_unref(int1);
g_assert(qdict_get_int(test_dict, "1") == 23);
g_assert(qdict_get_int(test_dict, "1.x") == 84);
g_assert(qdict_size(test_dict) == 2);
- QDECREF(test_dict);
+ qobject_unref(test_dict);
}
static void qdict_array_entries_test(void)
@@ -493,7 +493,7 @@ static void qdict_array_entries_test(void)
g_assert_cmpint(qdict_array_entries(dict, "foo."), ==, 3);
g_assert_cmpint(qdict_array_entries(dict, ""), ==, -EINVAL);
- QDECREF(dict);
+ qobject_unref(dict);
dict = qdict_new();
qdict_put_int(dict, "1", 0);
@@ -509,7 +509,7 @@ static void qdict_array_entries_test(void)
qdict_put_int(dict, "2.c", 0);
g_assert_cmpint(qdict_array_entries(dict, ""), ==, 3);
- QDECREF(dict);
+ qobject_unref(dict);
}
static void qdict_join_test(void)
@@ -587,8 +587,8 @@ static void qdict_join_test(void)
}
while (overwrite ^= true);
- QDECREF(dict1);
- QDECREF(dict2);
+ qobject_unref(dict1);
+ qobject_unref(dict2);
}
static void qdict_crumple_test_recursive(void)
@@ -634,21 +634,21 @@ static void qdict_crumple_test_recursive(void)
g_assert_cmpint(qdict_size(rule), ==, 2);
g_assert_cmpstr("fred", ==, qdict_get_str(rule, "match"));
g_assert_cmpstr("allow", ==, qdict_get_str(rule, "policy"));
- QDECREF(rule);
+ qobject_unref(rule);
rule = qobject_to(QDict, qlist_pop(rules));
g_assert(rule);
g_assert_cmpint(qdict_size(rule), ==, 2);
g_assert_cmpstr("bob", ==, qdict_get_str(rule, "match"));
g_assert_cmpstr("deny", ==, qdict_get_str(rule, "policy"));
- QDECREF(rule);
+ qobject_unref(rule);
/* With recursive crumpling, we should see all names unescaped */
g_assert_cmpstr("acl0", ==, qdict_get_str(vnc, "acl.name"));
g_assert_cmpstr("acl0", ==, qdict_get_str(acl, "rule.name"));
- QDECREF(src);
- QDECREF(dst);
+ qobject_unref(src);
+ qobject_unref(dst);
}
static void qdict_crumple_test_empty(void)
@@ -661,8 +661,8 @@ static void qdict_crumple_test_empty(void)
g_assert_cmpint(qdict_size(dst), ==, 0);
- QDECREF(src);
- QDECREF(dst);
+ qobject_unref(src);
+ qobject_unref(dst);
}
static int qdict_count_entries(QDict *dict)
@@ -704,7 +704,7 @@ static void qdict_rename_keys_test(void)
g_assert(qobject_type(qdict_get(copy, "nothing")) == QTYPE_QNULL);
g_assert_cmpint(qdict_count_entries(copy), ==, 5);
- QDECREF(copy);
+ qobject_unref(copy);
/* Simple rename of all entries */
renames = (QDictRenames[]) {
@@ -731,7 +731,7 @@ static void qdict_rename_keys_test(void)
g_assert(qobject_type(qdict_get(copy, "null")) == QTYPE_QNULL);
g_assert_cmpint(qdict_count_entries(copy), ==, 5);
- QDECREF(copy);
+ qobject_unref(copy);
/* Renames are processed top to bottom */
renames = (QDictRenames[]) {
@@ -754,7 +754,7 @@ static void qdict_rename_keys_test(void)
g_assert(!qdict_haskey(copy, "tmp"));
g_assert_cmpint(qdict_count_entries(copy), ==, 5);
- QDECREF(copy);
+ qobject_unref(copy);
/* Conflicting rename */
renames = (QDictRenames[]) {
@@ -775,7 +775,7 @@ static void qdict_rename_keys_test(void)
g_assert(qobject_type(qdict_get(copy, "nothing")) == QTYPE_QNULL);
g_assert_cmpint(qdict_count_entries(copy), ==, 5);
- QDECREF(copy);
+ qobject_unref(copy);
/* Renames in an empty dict */
renames = (QDictRenames[]) {
@@ -783,13 +783,13 @@ static void qdict_rename_keys_test(void)
{ NULL , NULL }
};
- QDECREF(dict);
+ qobject_unref(dict);
dict = qdict_new();
qdict_rename_keys(dict, renames, &error_abort);
g_assert(qdict_first(dict) == NULL);
- QDECREF(dict);
+ qobject_unref(dict);
}
static void qdict_crumple_test_bad_inputs(void)
@@ -806,7 +806,7 @@ static void qdict_crumple_test_bad_inputs(void)
g_assert(error != NULL);
error_free(error);
error = NULL;
- QDECREF(src);
+ qobject_unref(src);
src = qdict_new();
/* rule can't be both a list and a dict */
@@ -817,7 +817,7 @@ static void qdict_crumple_test_bad_inputs(void)
g_assert(error != NULL);
error_free(error);
error = NULL;
- QDECREF(src);
+ qobject_unref(src);
src = qdict_new();
/* The input should be flat, ie no dicts or lists */
@@ -828,7 +828,7 @@ static void qdict_crumple_test_bad_inputs(void)
g_assert(error != NULL);
error_free(error);
error = NULL;
- QDECREF(src);
+ qobject_unref(src);
src = qdict_new();
/* List indexes must not have gaps */
@@ -839,7 +839,7 @@ static void qdict_crumple_test_bad_inputs(void)
g_assert(error != NULL);
error_free(error);
error = NULL;
- QDECREF(src);
+ qobject_unref(src);
src = qdict_new();
/* List indexes must be in %zu format */
@@ -850,7 +850,7 @@ static void qdict_crumple_test_bad_inputs(void)
g_assert(error != NULL);
error_free(error);
error = NULL;
- QDECREF(src);
+ qobject_unref(src);
}
/*
@@ -871,7 +871,7 @@ static void qdict_put_exists_test(void)
g_assert(qdict_size(tests_dict) == 1);
- QDECREF(tests_dict);
+ qobject_unref(tests_dict);
}
static void qdict_get_not_exists_test(void)
@@ -879,7 +879,7 @@ static void qdict_get_not_exists_test(void)
QDict *tests_dict = qdict_new();
g_assert(qdict_get(tests_dict, "foo") == NULL);
- QDECREF(tests_dict);
+ qobject_unref(tests_dict);
}
/*
@@ -951,7 +951,7 @@ static void qdict_stress_test(void)
g_assert(strcmp(str1, str2) == 0);
- QDECREF(value);
+ qobject_unref(value);
}
// Delete everything
@@ -962,14 +962,14 @@ static void qdict_stress_test(void)
break;
qdict_del(qdict, key);
- QDECREF(value);
+ qobject_unref(value);
g_assert(qdict_haskey(qdict, key) == 0);
}
fclose(test_file);
g_assert(qdict_size(qdict) == 0);
- QDECREF(qdict);
+ qobject_unref(qdict);
}
int main(int argc, char **argv)
diff --git a/tests/check-qjson.c b/tests/check-qjson.c
index 997f4d3..da582df 100644
--- a/tests/check-qjson.c
+++ b/tests/check-qjson.c
@@ -67,10 +67,10 @@ static void escaped_string(void)
if (test_cases[i].skip == 0) {
str = qobject_to_json(obj);
g_assert_cmpstr(qstring_get_str(str), ==, test_cases[i].encoded);
- qobject_decref(obj);
+ qobject_unref(obj);
}
- QDECREF(str);
+ qobject_unref(str);
}
}
@@ -99,9 +99,9 @@ static void simple_string(void)
str = qobject_to_json(obj);
g_assert(strcmp(qstring_get_str(str), test_cases[i].encoded) == 0);
- qobject_decref(obj);
+ qobject_unref(obj);
- QDECREF(str);
+ qobject_unref(str);
}
}
@@ -127,7 +127,7 @@ static void single_quote_string(void)
g_assert(str);
g_assert(strcmp(qstring_get_str(str), test_cases[i].decoded) == 0);
- QDECREF(str);
+ qobject_unref(str);
}
}
@@ -823,7 +823,7 @@ static void utf8_string(void)
} else {
g_assert(!obj);
}
- qobject_decref(obj);
+ qobject_unref(obj);
obj = QOBJECT(qstring_from_str(utf8_in));
str = qobject_to_json(obj);
@@ -833,8 +833,8 @@ static void utf8_string(void)
} else {
g_assert(!str);
}
- QDECREF(str);
- qobject_decref(obj);
+ qobject_unref(str);
+ qobject_unref(obj);
/*
* Disabled, because qobject_from_json() is buggy, and I can't
@@ -869,7 +869,7 @@ static void vararg_string(void)
g_assert(str);
g_assert(strcmp(qstring_get_str(str), test_cases[i].decoded) == 0);
- QDECREF(str);
+ qobject_unref(str);
}
}
@@ -904,10 +904,10 @@ static void simple_number(void)
str = qobject_to_json(QOBJECT(qnum));
g_assert(strcmp(qstring_get_str(str), test_cases[i].encoded) == 0);
- QDECREF(str);
+ qobject_unref(str);
}
- QDECREF(qnum);
+ qobject_unref(qnum);
}
}
@@ -928,8 +928,8 @@ static void large_number(void)
str = qobject_to_json(QOBJECT(qnum));
g_assert_cmpstr(qstring_get_str(str), ==, maxu64);
- QDECREF(str);
- QDECREF(qnum);
+ qobject_unref(str);
+ qobject_unref(qnum);
qnum = qobject_to(QNum, qobject_from_json(gtu64, &error_abort));
g_assert(qnum);
@@ -939,8 +939,8 @@ static void large_number(void)
str = qobject_to_json(QOBJECT(qnum));
g_assert_cmpstr(qstring_get_str(str), ==, gtu64);
- QDECREF(str);
- QDECREF(qnum);
+ qobject_unref(str);
+ qobject_unref(qnum);
qnum = qobject_to(QNum, qobject_from_json(lti64, &error_abort));
g_assert(qnum);
@@ -950,8 +950,8 @@ static void large_number(void)
str = qobject_to_json(QOBJECT(qnum));
g_assert_cmpstr(qstring_get_str(str), ==, "-9223372036854775808");
- QDECREF(str);
- QDECREF(qnum);
+ qobject_unref(str);
+ qobject_unref(qnum);
}
static void float_number(void)
@@ -983,10 +983,10 @@ static void float_number(void)
str = qobject_to_json(obj);
g_assert(strcmp(qstring_get_str(str), test_cases[i].encoded) == 0);
- QDECREF(str);
+ qobject_unref(str);
}
- QDECREF(qnum);
+ qobject_unref(qnum);
}
}
@@ -1001,16 +1001,16 @@ static void vararg_number(void)
qnum = qobject_to(QNum, qobject_from_jsonf("%d", value));
g_assert(qnum_get_try_int(qnum, &val));
g_assert_cmpint(val, ==, value);
- QDECREF(qnum);
+ qobject_unref(qnum);
qnum = qobject_to(QNum, qobject_from_jsonf("%lld", value_ll));
g_assert(qnum_get_try_int(qnum, &val));
g_assert_cmpint(val, ==, value_ll);
- QDECREF(qnum);
+ qobject_unref(qnum);
qnum = qobject_to(QNum, qobject_from_jsonf("%f", valuef));
g_assert(qnum_get_double(qnum) == valuef);
- QDECREF(qnum);
+ qobject_unref(qnum);
}
static void keyword_literal(void)
@@ -1027,9 +1027,9 @@ static void keyword_literal(void)
str = qobject_to_json(obj);
g_assert(strcmp(qstring_get_str(str), "true") == 0);
- QDECREF(str);
+ qobject_unref(str);
- QDECREF(qbool);
+ qobject_unref(qbool);
obj = qobject_from_json("false", &error_abort);
qbool = qobject_to(QBool, obj);
@@ -1038,20 +1038,20 @@ static void keyword_literal(void)
str = qobject_to_json(obj);
g_assert(strcmp(qstring_get_str(str), "false") == 0);
- QDECREF(str);
+ qobject_unref(str);
- QDECREF(qbool);
+ qobject_unref(qbool);
qbool = qobject_to(QBool, qobject_from_jsonf("%i", false));
g_assert(qbool);
g_assert(qbool_get_bool(qbool) == false);
- QDECREF(qbool);
+ qobject_unref(qbool);
/* Test that non-zero values other than 1 get collapsed to true */
qbool = qobject_to(QBool, qobject_from_jsonf("%i", 2));
g_assert(qbool);
g_assert(qbool_get_bool(qbool) == true);
- QDECREF(qbool);
+ qobject_unref(qbool);
obj = qobject_from_json("null", &error_abort);
g_assert(obj != NULL);
@@ -1060,8 +1060,8 @@ static void keyword_literal(void)
null = qnull();
g_assert(QOBJECT(null) == obj);
- qobject_decref(obj);
- QDECREF(null);
+ qobject_unref(obj);
+ qobject_unref(null);
}
static void simple_dict(void)
@@ -1101,12 +1101,12 @@ static void simple_dict(void)
g_assert(qlit_equal_qobject(&test_cases[i].decoded, obj));
str = qobject_to_json(obj);
- qobject_decref(obj);
+ qobject_unref(obj);
obj = qobject_from_json(qstring_get_str(str), &error_abort);
g_assert(qlit_equal_qobject(&test_cases[i].decoded, obj));
- qobject_decref(obj);
- QDECREF(str);
+ qobject_unref(obj);
+ qobject_unref(str);
}
}
@@ -1158,7 +1158,7 @@ static void large_dict(void)
obj = qobject_from_json(gstr->str, &error_abort);
g_assert(obj != NULL);
- qobject_decref(obj);
+ qobject_unref(obj);
g_string_free(gstr, true);
}
@@ -1210,12 +1210,12 @@ static void simple_list(void)
g_assert(qlit_equal_qobject(&test_cases[i].decoded, obj));
str = qobject_to_json(obj);
- qobject_decref(obj);
+ qobject_unref(obj);
obj = qobject_from_json(qstring_get_str(str), &error_abort);
g_assert(qlit_equal_qobject(&test_cases[i].decoded, obj));
- qobject_decref(obj);
- QDECREF(str);
+ qobject_unref(obj);
+ qobject_unref(str);
}
}
@@ -1272,13 +1272,13 @@ static void simple_whitespace(void)
g_assert(qlit_equal_qobject(&test_cases[i].decoded, obj));
str = qobject_to_json(obj);
- qobject_decref(obj);
+ qobject_unref(obj);
obj = qobject_from_json(qstring_get_str(str), &error_abort);
g_assert(qlit_equal_qobject(&test_cases[i].decoded, obj));
- qobject_decref(obj);
- QDECREF(str);
+ qobject_unref(obj);
+ qobject_unref(str);
}
}
@@ -1301,7 +1301,7 @@ static void simple_varargs(void)
obj = qobject_from_jsonf("[%d, 2, %p]", 1, embedded_obj);
g_assert(qlit_equal_qobject(&decoded, obj));
- qobject_decref(obj);
+ qobject_unref(obj);
}
static void empty_input(void)
@@ -1410,7 +1410,7 @@ static void limits_nesting(void)
obj = qobject_from_json(make_nest(buf, max_nesting), &error_abort);
g_assert(obj != NULL);
- qobject_decref(obj);
+ qobject_unref(obj);
obj = qobject_from_json(make_nest(buf, max_nesting + 1), &err);
error_free_or_abort(&err);
diff --git a/tests/check-qlist.c b/tests/check-qlist.c
index a1c69ed..ece83e2 100644
--- a/tests/check-qlist.c
+++ b/tests/check-qlist.c
@@ -29,7 +29,7 @@ static void qlist_new_test(void)
g_assert(qlist->base.refcnt == 1);
g_assert(qobject_type(QOBJECT(qlist)) == QTYPE_QLIST);
- QDECREF(qlist);
+ qobject_unref(qlist);
}
static void qlist_append_test(void)
@@ -47,7 +47,7 @@ static void qlist_append_test(void)
g_assert(entry != NULL);
g_assert(entry->value == QOBJECT(qi));
- QDECREF(qlist);
+ qobject_unref(qlist);
}
static void qobject_to_qlist_test(void)
@@ -58,7 +58,7 @@ static void qobject_to_qlist_test(void)
g_assert(qobject_to(QList, QOBJECT(qlist)) == qlist);
- QDECREF(qlist);
+ qobject_unref(qlist);
}
static int iter_called;
@@ -96,7 +96,7 @@ static void qlist_iter_test(void)
g_assert(iter_called == iter_max);
- QDECREF(qlist);
+ qobject_unref(qlist);
}
int main(int argc, char **argv)
diff --git a/tests/check-qlit.c b/tests/check-qlit.c
index 96bbb06..bd6798d 100644
--- a/tests/check-qlit.c
+++ b/tests/check-qlit.c
@@ -62,7 +62,7 @@ static void qlit_equal_qobject_test(void)
qdict_put(qobject_to(QDict, qobj), "bee", qlist_new());
g_assert(!qlit_equal_qobject(&qlit, qobj));
- qobject_decref(qobj);
+ qobject_unref(qobj);
}
static void qobject_from_qlit_test(void)
@@ -79,15 +79,15 @@ static void qobject_from_qlit_test(void)
bee = qdict_get_qlist(qdict, "bee");
obj = qlist_pop(bee);
g_assert_cmpint(qnum_get_int(qobject_to(QNum, obj)), ==, 43);
- qobject_decref(obj);
+ qobject_unref(obj);
obj = qlist_pop(bee);
g_assert_cmpint(qnum_get_int(qobject_to(QNum, obj)), ==, 44);
- qobject_decref(obj);
+ qobject_unref(obj);
obj = qlist_pop(bee);
g_assert(qbool_get_bool(qobject_to(QBool, obj)));
- qobject_decref(obj);
+ qobject_unref(obj);
- qobject_decref(qobj);
+ qobject_unref(qobj);
}
int main(int argc, char **argv)
diff --git a/tests/check-qnull.c b/tests/check-qnull.c
index afa4400..ebf21db 100644
--- a/tests/check-qnull.c
+++ b/tests/check-qnull.c
@@ -30,7 +30,7 @@ static void qnull_ref_test(void)
g_assert(obj == QOBJECT(&qnull_));
g_assert(qnull_.base.refcnt == 2);
g_assert(qobject_type(obj) == QTYPE_QNULL);
- qobject_decref(obj);
+ qobject_unref(obj);
g_assert(qnull_.base.refcnt == 1);
}
@@ -49,10 +49,10 @@ static void qnull_visit_test(void)
g_assert(qnull_.base.refcnt == 1);
obj = QOBJECT(qnull());
v = qobject_input_visitor_new(obj);
- qobject_decref(obj);
+ qobject_unref(obj);
visit_type_null(v, NULL, &null, &error_abort);
g_assert(obj == QOBJECT(&qnull_));
- QDECREF(null);
+ qobject_unref(null);
visit_free(v);
null = NULL;
@@ -60,8 +60,8 @@ static void qnull_visit_test(void)
visit_type_null(v, NULL, &null, &error_abort);
visit_complete(v, &obj);
g_assert(obj == QOBJECT(&qnull_));
- QDECREF(null);
- qobject_decref(obj);
+ qobject_unref(null);
+ qobject_unref(obj);
visit_free(v);
g_assert(qnull_.base.refcnt == 1);
diff --git a/tests/check-qnum.c b/tests/check-qnum.c
index 9187da7..4105015 100644
--- a/tests/check-qnum.c
+++ b/tests/check-qnum.c
@@ -35,7 +35,7 @@ static void qnum_from_int_test(void)
g_assert_cmpint(qn->base.refcnt, ==, 1);
g_assert_cmpint(qobject_type(QOBJECT(qn)), ==, QTYPE_QNUM);
- QDECREF(qn);
+ qobject_unref(qn);
}
static void qnum_from_uint_test(void)
@@ -50,7 +50,7 @@ static void qnum_from_uint_test(void)
g_assert(qn->base.refcnt == 1);
g_assert(qobject_type(QOBJECT(qn)) == QTYPE_QNUM);
- QDECREF(qn);
+ qobject_unref(qn);
}
static void qnum_from_double_test(void)
@@ -65,7 +65,7 @@ static void qnum_from_double_test(void)
g_assert_cmpint(qn->base.refcnt, ==, 1);
g_assert_cmpint(qobject_type(QOBJECT(qn)), ==, QTYPE_QNUM);
- QDECREF(qn);
+ qobject_unref(qn);
}
static void qnum_from_int64_test(void)
@@ -76,7 +76,7 @@ static void qnum_from_int64_test(void)
qn = qnum_from_int(value);
g_assert_cmpint((int64_t) qn->u.i64, ==, value);
- QDECREF(qn);
+ qobject_unref(qn);
}
static void qnum_get_int_test(void)
@@ -87,7 +87,7 @@ static void qnum_get_int_test(void)
qn = qnum_from_int(value);
g_assert_cmpint(qnum_get_int(qn), ==, value);
- QDECREF(qn);
+ qobject_unref(qn);
}
static void qnum_get_uint_test(void)
@@ -100,25 +100,25 @@ static void qnum_get_uint_test(void)
qn = qnum_from_uint(value);
g_assert(qnum_get_try_uint(qn, &val));
g_assert_cmpuint(val, ==, value);
- QDECREF(qn);
+ qobject_unref(qn);
qn = qnum_from_int(value);
g_assert(qnum_get_try_uint(qn, &val));
g_assert_cmpuint(val, ==, value);
- QDECREF(qn);
+ qobject_unref(qn);
/* invalid cases */
qn = qnum_from_int(-1);
g_assert(!qnum_get_try_uint(qn, &val));
- QDECREF(qn);
+ qobject_unref(qn);
qn = qnum_from_uint(-1ULL);
g_assert(!qnum_get_try_int(qn, &ival));
- QDECREF(qn);
+ qobject_unref(qn);
qn = qnum_from_double(0.42);
g_assert(!qnum_get_try_uint(qn, &val));
- QDECREF(qn);
+ qobject_unref(qn);
}
static void qobject_to_qnum_test(void)
@@ -127,11 +127,11 @@ static void qobject_to_qnum_test(void)
qn = qnum_from_int(0);
g_assert(qobject_to(QNum, QOBJECT(qn)) == qn);
- QDECREF(qn);
+ qobject_unref(qn);
qn = qnum_from_double(0);
g_assert(qobject_to(QNum, QOBJECT(qn)) == qn);
- QDECREF(qn);
+ qobject_unref(qn);
}
static void qnum_to_string_test(void)
@@ -143,13 +143,13 @@ static void qnum_to_string_test(void)
tmp = qnum_to_string(qn);
g_assert_cmpstr(tmp, ==, "123456");
g_free(tmp);
- QDECREF(qn);
+ qobject_unref(qn);
qn = qnum_from_double(0.42);
tmp = qnum_to_string(qn);
g_assert_cmpstr(tmp, ==, "0.42");
g_free(tmp);
- QDECREF(qn);
+ qobject_unref(qn);
}
int main(int argc, char **argv)
diff --git a/tests/check-qobject.c b/tests/check-qobject.c
index 7629b80..5cb08fc 100644
--- a/tests/check-qobject.c
+++ b/tests/check-qobject.c
@@ -80,7 +80,7 @@ static void do_free_all(int _, ...)
va_start(ap, _);
while ((obj = va_arg(ap, QObject *)) != NULL) {
- qobject_decref(obj);
+ qobject_unref(obj);
}
va_end(ap);
}
diff --git a/tests/check-qstring.c b/tests/check-qstring.c
index 9c4dd3f..f11a7a8 100644
--- a/tests/check-qstring.c
+++ b/tests/check-qstring.c
@@ -31,7 +31,7 @@ static void qstring_from_str_test(void)
g_assert(strcmp(str, qstring->string) == 0);
g_assert(qobject_type(QOBJECT(qstring)) == QTYPE_QSTRING);
- QDECREF(qstring);
+ qobject_unref(qstring);
}
static void qstring_get_str_test(void)
@@ -44,7 +44,7 @@ static void qstring_get_str_test(void)
ret_str = qstring_get_str(qstring);
g_assert(strcmp(ret_str, str) == 0);
- QDECREF(qstring);
+ qobject_unref(qstring);
}
static void qstring_append_chr_test(void)
@@ -59,7 +59,7 @@ static void qstring_append_chr_test(void)
qstring_append_chr(qstring, str[i]);
g_assert(strcmp(str, qstring_get_str(qstring)) == 0);
- QDECREF(qstring);
+ qobject_unref(qstring);
}
static void qstring_from_substr_test(void)
@@ -70,7 +70,7 @@ static void qstring_from_substr_test(void)
g_assert(qs != NULL);
g_assert(strcmp(qstring_get_str(qs), "tualiza") == 0);
- QDECREF(qs);
+ qobject_unref(qs);
}
@@ -81,7 +81,7 @@ static void qobject_to_qstring_test(void)
qstring = qstring_from_str("foo");
g_assert(qobject_to(QString, QOBJECT(qstring)) == qstring);
- QDECREF(qstring);
+ qobject_unref(qstring);
}
int main(int argc, char **argv)
diff --git a/tests/cpu-plug-test.c b/tests/cpu-plug-test.c
index 8b5ab1f..5f39ba0 100644
--- a/tests/cpu-plug-test.c
+++ b/tests/cpu-plug-test.c
@@ -42,7 +42,7 @@ static void test_plug_with_cpu_add(gconstpointer data)
" 'arguments': { 'id': %d } }", i);
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
}
qtest_end();
@@ -66,7 +66,7 @@ static void test_plug_without_cpu_add(gconstpointer data)
s->sockets * s->cores * s->threads);
g_assert(response);
g_assert(qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
qtest_end();
g_free(args);
diff --git a/tests/device-introspect-test.c b/tests/device-introspect-test.c
index a01321a..0b4f221 100644
--- a/tests/device-introspect-test.c
+++ b/tests/device-introspect-test.c
@@ -40,8 +40,8 @@ static QList *qom_list_types(const char *implements, bool abstract)
" 'arguments': %p }", args);
g_assert(qdict_haskey(resp, "return"));
ret = qdict_get_qlist(resp, "return");
- QINCREF(ret);
- QDECREF(resp);
+ qobject_ref(ret);
+ qobject_unref(resp);
return ret;
}
@@ -54,7 +54,7 @@ static QDict *qom_type_index(QList *types)
QLIST_FOREACH_ENTRY(types, e) {
QDict *d = qobject_to(QDict, qlist_entry_obj(e));
const char *name = qdict_get_str(d, "name");
- QINCREF(d);
+ qobject_ref(d);
qdict_put(index, name, d);
}
return index;
@@ -108,7 +108,7 @@ static void test_one_device(const char *type)
resp = qmp("{'execute': 'device-list-properties',"
" 'arguments': {'typename': %s}}",
type);
- QDECREF(resp);
+ qobject_unref(resp);
help = hmp("device_add \"%s,help\"", type);
g_free(help);
@@ -129,7 +129,7 @@ static void test_device_intro_list(void)
qtest_start(common_args);
types = device_type_list(true);
- QDECREF(types);
+ qobject_unref(types);
help = hmp("device_add help");
g_free(help);
@@ -157,8 +157,8 @@ static void test_qom_list_parents(const char *parent)
g_assert(qom_has_parent(index, name, parent));
}
- QDECREF(types);
- QDECREF(index);
+ qobject_unref(types);
+ qobject_unref(index);
}
static void test_qom_list_fields(void)
@@ -187,8 +187,8 @@ static void test_qom_list_fields(void)
test_qom_list_parents("device");
test_qom_list_parents("sys-bus-device");
- QDECREF(all_types);
- QDECREF(non_abstract);
+ qobject_unref(all_types);
+ qobject_unref(non_abstract);
qtest_end();
}
@@ -222,7 +222,7 @@ static void test_device_intro_concrete(void)
test_one_device(type);
}
- QDECREF(types);
+ qobject_unref(types);
qtest_end();
}
@@ -255,8 +255,8 @@ static void test_abstract_interfaces(void)
g_assert(qdict_haskey(d, "abstract") && qdict_get_bool(d, "abstract"));
}
- QDECREF(all_types);
- QDECREF(index);
+ qobject_unref(all_types);
+ qobject_unref(index);
qtest_end();
}
diff --git a/tests/drive_del-test.c b/tests/drive_del-test.c
index 313030a..852fefc 100644
--- a/tests/drive_del-test.c
+++ b/tests/drive_del-test.c
@@ -41,7 +41,7 @@ static void device_del(void)
response = qmp_receive();
g_assert(response);
g_assert(qdict_haskey(response, "return"));
- QDECREF(response);
+ qobject_unref(response);
}
static void test_drive_without_dev(void)
@@ -78,7 +78,7 @@ static void test_after_failed_device_add(void)
g_assert(response);
error = qdict_get_qdict(response, "error");
g_assert_cmpstr(qdict_get_try_str(error, "class"), ==, "GenericError");
- QDECREF(response);
+ qobject_unref(response);
/* Delete the drive */
drive_del();
diff --git a/tests/libqos/libqos.c b/tests/libqos/libqos.c
index 5124e98..013ca68 100644
--- a/tests/libqos/libqos.c
+++ b/tests/libqos/libqos.c
@@ -100,14 +100,14 @@ void migrate(QOSState *from, QOSState *to, const char *uri)
sub = qdict_get_qdict(rsp, "return");
g_assert(qdict_haskey(sub, "running"));
running = qdict_get_bool(sub, "running");
- QDECREF(rsp);
+ qobject_unref(rsp);
/* Issue the migrate command. */
rsp = qtest_qmp(from->qts,
"{ 'execute': 'migrate', 'arguments': { 'uri': %s }}",
uri);
g_assert(qdict_haskey(rsp, "return"));
- QDECREF(rsp);
+ qobject_unref(rsp);
/* Wait for STOP event, but only if we were running: */
if (running) {
@@ -132,12 +132,12 @@ void migrate(QOSState *from, QOSState *to, const char *uri)
/* "setup", "active", "completed", "failed", "cancelled" */
if (strcmp(st, "completed") == 0) {
- QDECREF(rsp);
+ qobject_unref(rsp);
break;
}
if ((strcmp(st, "setup") == 0) || (strcmp(st, "active") == 0)) {
- QDECREF(rsp);
+ qobject_unref(rsp);
g_usleep(5000);
continue;
}
diff --git a/tests/libqos/pci-pc.c b/tests/libqos/pci-pc.c
index a2daf61..a780330 100644
--- a/tests/libqos/pci-pc.c
+++ b/tests/libqos/pci-pc.c
@@ -170,7 +170,7 @@ void qpci_unplug_acpi_device_test(const char *id, uint8_t slot)
g_free(cmd);
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
outb(ACPI_PCIHP_ADDR + PCI_EJ_BASE, 1 << slot);
diff --git a/tests/libqtest.c b/tests/libqtest.c
index 6f33a37..43fb97e 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -517,8 +517,8 @@ void qmp_fd_sendv(int fd, const char *fmt, va_list ap)
/* Send QMP request */
socket_send(fd, str, qstring_get_length(qstr));
- QDECREF(qstr);
- qobject_decref(qobj);
+ qobject_unref(qstr);
+ qobject_unref(qobj);
}
}
@@ -585,7 +585,7 @@ void qtest_async_qmp(QTestState *s, const char *fmt, ...)
void qtest_qmpv_discard_response(QTestState *s, const char *fmt, va_list ap)
{
QDict *response = qtest_qmpv(s, fmt, ap);
- QDECREF(response);
+ qobject_unref(response);
}
void qtest_qmp_discard_response(QTestState *s, const char *fmt, ...)
@@ -596,7 +596,7 @@ void qtest_qmp_discard_response(QTestState *s, const char *fmt, ...)
va_start(ap, fmt);
response = qtest_qmpv(s, fmt, ap);
va_end(ap);
- QDECREF(response);
+ qobject_unref(response);
}
QDict *qtest_qmp_eventwait_ref(QTestState *s, const char *event)
@@ -609,7 +609,7 @@ QDict *qtest_qmp_eventwait_ref(QTestState *s, const char *event)
(strcmp(qdict_get_str(response, "event"), event) == 0)) {
return response;
}
- QDECREF(response);
+ qobject_unref(response);
}
}
@@ -618,7 +618,7 @@ void qtest_qmp_eventwait(QTestState *s, const char *event)
QDict *response;
response = qtest_qmp_eventwait_ref(s, event);
- QDECREF(response);
+ qobject_unref(response);
}
char *qtest_hmpv(QTestState *s, const char *fmt, va_list ap)
@@ -634,12 +634,12 @@ char *qtest_hmpv(QTestState *s, const char *fmt, va_list ap)
ret = g_strdup(qdict_get_try_str(resp, "return"));
while (ret == NULL && qdict_get_try_str(resp, "event")) {
/* Ignore asynchronous QMP events */
- QDECREF(resp);
+ qobject_unref(resp);
resp = qtest_qmp_receive(s);
ret = g_strdup(qdict_get_try_str(resp, "return"));
}
g_assert(ret);
- QDECREF(resp);
+ qobject_unref(resp);
g_free(cmd);
return ret;
}
@@ -1021,7 +1021,7 @@ void qtest_cb_for_every_machine(void (*cb)(const char *machine))
}
qtest_end();
- QDECREF(response);
+ qobject_unref(response);
}
/*
@@ -1050,7 +1050,7 @@ void qtest_qmp_device_add(const char *driver, const char *id, const char *fmt,
g_assert(response);
g_assert(!qdict_haskey(response, "event")); /* We don't expect any events */
g_assert(!qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
}
/*
@@ -1095,6 +1095,6 @@ void qtest_qmp_device_del(const char *id)
g_assert(event);
g_assert_cmpstr(qdict_get_str(event, "event"), ==, "DEVICE_DELETED");
- QDECREF(response1);
- QDECREF(response2);
+ qobject_unref(response1);
+ qobject_unref(response2);
}
diff --git a/tests/machine-none-test.c b/tests/machine-none-test.c
index efdd4be..f286557 100644
--- a/tests/machine-none-test.c
+++ b/tests/machine-none-test.c
@@ -88,7 +88,7 @@ static void test_machine_cpu_cli(void)
response = qmp("{ 'execute': 'quit' }");
g_assert(qdict_haskey(response, "return"));
- QDECREF(response);
+ qobject_unref(response);
qtest_quit(global_qtest);
}
diff --git a/tests/migration-test.c b/tests/migration-test.c
index dde7c46..b99661b 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -195,7 +195,7 @@ static QDict *wait_command(QTestState *who, const char *command)
if (!strcmp(event_string, "STOP")) {
got_stop = true;
}
- QDECREF(response);
+ qobject_unref(response);
response = qtest_qmp_receive(who);
}
return response;
@@ -221,7 +221,7 @@ static uint64_t get_migration_pass(QTestState *who)
rsp_ram = qdict_get_qdict(rsp_return, "ram");
result = qdict_get_try_int(rsp_ram, "dirty-sync-count", 0);
}
- QDECREF(rsp);
+ qobject_unref(rsp);
return result;
}
@@ -232,7 +232,7 @@ static void read_blocktime(QTestState *who)
rsp = wait_command(who, "{ 'execute': 'query-migrate' }");
rsp_return = qdict_get_qdict(rsp, "return");
g_assert(qdict_haskey(rsp_return, "postcopy-blocktime"));
- QDECREF(rsp);
+ qobject_unref(rsp);
}
static void wait_for_migration_complete(QTestState *who)
@@ -247,7 +247,7 @@ static void wait_for_migration_complete(QTestState *who)
status = qdict_get_str(rsp_return, "status");
completed = strcmp(status, "completed") == 0;
g_assert_cmpstr(status, !=, "failed");
- QDECREF(rsp);
+ qobject_unref(rsp);
if (completed) {
return;
}
@@ -334,7 +334,7 @@ static void migrate_check_parameter(QTestState *who, const char *parameter,
qdict_get_try_int(rsp_return, parameter, -1));
g_assert_cmpstr(result, ==, value);
g_free(result);
- QDECREF(rsp);
+ qobject_unref(rsp);
}
static void migrate_set_parameter(QTestState *who, const char *parameter,
@@ -349,7 +349,7 @@ static void migrate_set_parameter(QTestState *who, const char *parameter,
rsp = qtest_qmp(who, cmd);
g_free(cmd);
g_assert(qdict_haskey(rsp, "return"));
- QDECREF(rsp);
+ qobject_unref(rsp);
migrate_check_parameter(who, parameter, value);
}
@@ -367,7 +367,7 @@ static void migrate_set_capability(QTestState *who, const char *capability,
rsp = qtest_qmp(who, cmd);
g_free(cmd);
g_assert(qdict_haskey(rsp, "return"));
- QDECREF(rsp);
+ qobject_unref(rsp);
}
static void migrate(QTestState *who, const char *uri)
@@ -381,7 +381,7 @@ static void migrate(QTestState *who, const char *uri)
rsp = qtest_qmp(who, cmd);
g_free(cmd);
g_assert(qdict_haskey(rsp, "return"));
- QDECREF(rsp);
+ qobject_unref(rsp);
}
static void migrate_start_postcopy(QTestState *who)
@@ -390,7 +390,7 @@ static void migrate_start_postcopy(QTestState *who)
rsp = wait_command(who, "{ 'execute': 'migrate-start-postcopy' }");
g_assert(qdict_haskey(rsp, "return"));
- QDECREF(rsp);
+ qobject_unref(rsp);
}
static void test_migrate_start(QTestState **from, QTestState **to,
@@ -503,7 +503,7 @@ static void deprecated_set_downtime(QTestState *who, const double value)
rsp = qtest_qmp(who, cmd);
g_free(cmd);
g_assert(qdict_haskey(rsp, "return"));
- QDECREF(rsp);
+ qobject_unref(rsp);
result_int = value * 1000L;
expected = g_strdup_printf("%" PRId64, result_int);
migrate_check_parameter(who, "downtime-limit", expected);
@@ -520,7 +520,7 @@ static void deprecated_set_speed(QTestState *who, const char *value)
rsp = qtest_qmp(who, cmd);
g_free(cmd);
g_assert(qdict_haskey(rsp, "return"));
- QDECREF(rsp);
+ qobject_unref(rsp);
migrate_check_parameter(who, "max-bandwidth", value);
}
@@ -597,7 +597,7 @@ static void test_baddest(void)
g_assert(!strcmp(status, "setup") || !(strcmp(status, "failed")));
failed = !strcmp(status, "failed");
- QDECREF(rsp);
+ qobject_unref(rsp);
} while (!failed);
/* Is the machine currently running? */
@@ -606,7 +606,7 @@ static void test_baddest(void)
rsp_return = qdict_get_qdict(rsp, "return");
g_assert(qdict_haskey(rsp_return, "running"));
g_assert(qdict_get_bool(rsp_return, "running"));
- QDECREF(rsp);
+ qobject_unref(rsp);
test_migrate_end(from, to, false);
}
diff --git a/tests/numa-test.c b/tests/numa-test.c
index 0f861d8..169213f 100644
--- a/tests/numa-test.c
+++ b/tests/numa-test.c
@@ -111,10 +111,10 @@ static void test_query_cpus(const void *data)
} else {
g_assert_cmpint(node, ==, 1);
}
- qobject_decref(e);
+ qobject_unref(e);
}
- QDECREF(resp);
+ qobject_unref(resp);
qtest_end();
g_free(cli);
}
@@ -164,10 +164,10 @@ static void pc_numa_cpu(const void *data)
} else {
g_assert(false);
}
- qobject_decref(e);
+ qobject_unref(e);
}
- QDECREF(resp);
+ qobject_unref(resp);
qtest_end();
g_free(cli);
}
@@ -209,10 +209,10 @@ static void spapr_numa_cpu(const void *data)
} else {
g_assert(false);
}
- qobject_decref(e);
+ qobject_unref(e);
}
- QDECREF(resp);
+ qobject_unref(resp);
qtest_end();
g_free(cli);
}
@@ -252,10 +252,10 @@ static void aarch64_numa_cpu(const void *data)
} else {
g_assert(false);
}
- qobject_decref(e);
+ qobject_unref(e);
}
- QDECREF(resp);
+ qobject_unref(resp);
qtest_end();
g_free(cli);
}
diff --git a/tests/pvpanic-test.c b/tests/pvpanic-test.c
index ebdf32c..7461a72 100644
--- a/tests/pvpanic-test.c
+++ b/tests/pvpanic-test.c
@@ -28,7 +28,7 @@ static void test_panic(void)
data = qdict_get_qdict(response, "data");
g_assert(qdict_haskey(data, "action"));
g_assert_cmpstr(qdict_get_str(data, "action"), ==, "pause");
- QDECREF(response);
+ qobject_unref(response);
}
int main(int argc, char **argv)
diff --git a/tests/q35-test.c b/tests/q35-test.c
index 3eaedf4..7ea7acc 100644
--- a/tests/q35-test.c
+++ b/tests/q35-test.c
@@ -109,7 +109,7 @@ static void test_smram_lock(void)
response = qmp("{'execute': 'system_reset', 'arguments': {} }");
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
/* check open is settable again */
smram_set_bit(pcidev, MCH_HOST_BRIDGE_SMRAM_D_OPEN, false);
diff --git a/tests/qmp-test.c b/tests/qmp-test.c
index 772058f..88f867f 100644
--- a/tests/qmp-test.c
+++ b/tests/qmp-test.c
@@ -52,27 +52,27 @@ static void test_malformed(QTestState *qts)
/* Not even a dictionary */
resp = qtest_qmp(qts, "null");
g_assert_cmpstr(get_error_class(resp), ==, "GenericError");
- QDECREF(resp);
+ qobject_unref(resp);
/* No "execute" key */
resp = qtest_qmp(qts, "{}");
g_assert_cmpstr(get_error_class(resp), ==, "GenericError");
- QDECREF(resp);
+ qobject_unref(resp);
/* "execute" isn't a string */
resp = qtest_qmp(qts, "{ 'execute': true }");
g_assert_cmpstr(get_error_class(resp), ==, "GenericError");
- QDECREF(resp);
+ qobject_unref(resp);
/* "arguments" isn't a dictionary */
resp = qtest_qmp(qts, "{ 'execute': 'no-such-cmd', 'arguments': [] }");
g_assert_cmpstr(get_error_class(resp), ==, "GenericError");
- QDECREF(resp);
+ qobject_unref(resp);
/* extra key */
resp = qtest_qmp(qts, "{ 'execute': 'no-such-cmd', 'extra': true }");
g_assert_cmpstr(get_error_class(resp), ==, "GenericError");
- QDECREF(resp);
+ qobject_unref(resp);
}
static void test_qmp_protocol(void)
@@ -90,12 +90,12 @@ static void test_qmp_protocol(void)
test_version(qdict_get(q, "version"));
capabilities = qdict_get_qlist(q, "capabilities");
g_assert(capabilities && qlist_empty(capabilities));
- QDECREF(resp);
+ qobject_unref(resp);
/* Test valid command before handshake */
resp = qtest_qmp(qts, "{ 'execute': 'query-version' }");
g_assert_cmpstr(get_error_class(resp), ==, "CommandNotFound");
- QDECREF(resp);
+ qobject_unref(resp);
/* Test malformed commands before handshake */
test_malformed(qts);
@@ -104,17 +104,17 @@ static void test_qmp_protocol(void)
resp = qtest_qmp(qts, "{ 'execute': 'qmp_capabilities' }");
ret = qdict_get_qdict(resp, "return");
g_assert(ret && !qdict_size(ret));
- QDECREF(resp);
+ qobject_unref(resp);
/* Test repeated handshake */
resp = qtest_qmp(qts, "{ 'execute': 'qmp_capabilities' }");
g_assert_cmpstr(get_error_class(resp), ==, "CommandNotFound");
- QDECREF(resp);
+ qobject_unref(resp);
/* Test valid command */
resp = qtest_qmp(qts, "{ 'execute': 'query-version' }");
test_version(qdict_get(resp, "return"));
- QDECREF(resp);
+ qobject_unref(resp);
/* Test malformed commands */
test_malformed(qts);
@@ -124,13 +124,13 @@ static void test_qmp_protocol(void)
ret = qdict_get_qdict(resp, "return");
g_assert(ret);
g_assert_cmpstr(qdict_get_try_str(resp, "id"), ==, "cookie#1");
- QDECREF(resp);
+ qobject_unref(resp);
/* Test command failure with 'id' */
resp = qtest_qmp(qts, "{ 'execute': 'human-monitor-command', 'id': 2 }");
g_assert_cmpstr(get_error_class(resp), ==, "GenericError");
g_assert_cmpint(qdict_get_int(resp, "id"), ==, 2);
- QDECREF(resp);
+ qobject_unref(resp);
qtest_quit(qts);
}
@@ -159,21 +159,21 @@ static void test_qmp_oob(void)
qstr = qobject_to(QString, entry->value);
g_assert(qstr);
g_assert_cmpstr(qstring_get_str(qstr), ==, "oob");
- QDECREF(resp);
+ qobject_unref(resp);
/* Try a fake capability, it should fail. */
resp = qtest_qmp(qts,
"{ 'execute': 'qmp_capabilities', "
" 'arguments': { 'enable': [ 'cap-does-not-exist' ] } }");
g_assert(qdict_haskey(resp, "error"));
- QDECREF(resp);
+ qobject_unref(resp);
/* Now, enable OOB in current QMP session, it should succeed. */
resp = qtest_qmp(qts,
"{ 'execute': 'qmp_capabilities', "
" 'arguments': { 'enable': [ 'oob' ] } }");
g_assert(qdict_haskey(resp, "return"));
- QDECREF(resp);
+ qobject_unref(resp);
/*
* Try any command that does not support OOB but with OOB flag. We
@@ -183,7 +183,7 @@ static void test_qmp_oob(void)
"{ 'execute': 'query-cpus',"
" 'control': { 'run-oob': true } }");
g_assert(qdict_haskey(resp, "error"));
- QDECREF(resp);
+ qobject_unref(resp);
/*
* First send the "x-oob-test" command with lock=true and
@@ -210,7 +210,7 @@ static void test_qmp_oob(void)
!g_strcmp0(cmd_id, "unlock-cmd")) {
acks++;
}
- QDECREF(resp);
+ qobject_unref(resp);
}
qtest_quit(qts);
@@ -271,7 +271,7 @@ static void test_query(const void *data)
-1, &error_abort),
==, expected_error_class);
}
- QDECREF(resp);
+ qobject_unref(resp);
qtest_end();
}
@@ -321,7 +321,7 @@ static void qmp_schema_init(QmpSchema *schema)
visit_type_SchemaInfoList(qiv, NULL, &schema->list, &error_abort);
visit_free(qiv);
- QDECREF(resp);
+ qobject_unref(resp);
qtest_end();
schema->hash = g_hash_table_new(g_str_hash, g_str_equal);
diff --git a/tests/qom-test.c b/tests/qom-test.c
index a34ff6b..e6f712c 100644
--- a/tests/qom-test.c
+++ b/tests/qom-test.c
@@ -57,7 +57,7 @@ static void test_properties(const char *path, bool recurse)
g_assert(response);
if (!recurse) {
- QDECREF(response);
+ qobject_unref(response);
return;
}
@@ -82,10 +82,10 @@ static void test_properties(const char *path, bool recurse)
path, prop);
/* qom-get may fail but should not, e.g., segfault. */
g_assert(tmp);
- QDECREF(tmp);
+ qobject_unref(tmp);
}
}
- QDECREF(response);
+ qobject_unref(response);
}
static void test_machine(gconstpointer data)
@@ -101,7 +101,7 @@ static void test_machine(gconstpointer data)
response = qmp("{ 'execute': 'quit' }");
g_assert(qdict_haskey(response, "return"));
- QDECREF(response);
+ qobject_unref(response);
qtest_end();
g_free(args);
diff --git a/tests/tco-test.c b/tests/tco-test.c
index aee17af..9945fb8 100644
--- a/tests/tco-test.c
+++ b/tests/tco-test.c
@@ -241,8 +241,8 @@ static QDict *get_watchdog_action(void)
QDict *data;
data = qdict_get_qdict(ev, "data");
- QINCREF(data);
- QDECREF(ev);
+ qobject_ref(data);
+ qobject_unref(ev);
return data;
}
@@ -265,7 +265,7 @@ static void test_tco_second_timeout_pause(void)
clock_step(ticks * TCO_TICK_NSEC * 2);
ad = get_watchdog_action();
g_assert(!strcmp(qdict_get_str(ad, "action"), "pause"));
- QDECREF(ad);
+ qobject_unref(ad);
stop_tco(&td);
test_end(&td);
@@ -290,7 +290,7 @@ static void test_tco_second_timeout_reset(void)
clock_step(ticks * TCO_TICK_NSEC * 2);
ad = get_watchdog_action();
g_assert(!strcmp(qdict_get_str(ad, "action"), "reset"));
- QDECREF(ad);
+ qobject_unref(ad);
stop_tco(&td);
test_end(&td);
@@ -315,7 +315,7 @@ static void test_tco_second_timeout_shutdown(void)
clock_step(ticks * TCO_TICK_NSEC * 2);
ad = get_watchdog_action();
g_assert(!strcmp(qdict_get_str(ad, "action"), "shutdown"));
- QDECREF(ad);
+ qobject_unref(ad);
stop_tco(&td);
test_end(&td);
@@ -340,7 +340,7 @@ static void test_tco_second_timeout_none(void)
clock_step(ticks * TCO_TICK_NSEC * 2);
ad = get_watchdog_action();
g_assert(!strcmp(qdict_get_str(ad, "action"), "none"));
- QDECREF(ad);
+ qobject_unref(ad);
stop_tco(&td);
test_end(&td);
diff --git a/tests/test-char.c b/tests/test-char.c
index 306c728..1880d36 100644
--- a/tests/test-char.c
+++ b/tests/test-char.c
@@ -322,7 +322,7 @@ static void char_socket_test_common(Chardev *chr)
qdict = qobject_to(QDict, addr);
port = qdict_get_str(qdict, "port");
tmp = g_strdup_printf("tcp:127.0.0.1:%s", port);
- QDECREF(qdict);
+ qobject_unref(qdict);
qemu_chr_fe_init(&be, chr, &error_abort);
qemu_chr_fe_set_handlers(&be, socket_can_read, socket_read,
diff --git a/tests/test-keyval.c b/tests/test-keyval.c
index 029f052..63cb146 100644
--- a/tests/test-keyval.c
+++ b/tests/test-keyval.c
@@ -30,7 +30,7 @@ static void test_keyval_parse(void)
/* Nothing */
qdict = keyval_parse("", NULL, &error_abort);
g_assert_cmpuint(qdict_size(qdict), ==, 0);
- QDECREF(qdict);
+ qobject_unref(qdict);
/* Empty key (qemu_opts_parse() accepts this) */
qdict = keyval_parse("=val", NULL, &err);
@@ -70,7 +70,7 @@ static void test_keyval_parse(void)
qdict = keyval_parse(params + 2, NULL, &error_abort);
g_assert_cmpuint(qdict_size(qdict), ==, 1);
g_assert_cmpstr(qdict_get_try_str(qdict, long_key + 1), ==, "v");
- QDECREF(qdict);
+ qobject_unref(qdict);
/* Long key fragment */
qdict = keyval_parse(params, NULL, &error_abort);
@@ -79,7 +79,7 @@ static void test_keyval_parse(void)
g_assert(sub_qdict);
g_assert_cmpuint(qdict_size(sub_qdict), ==, 1);
g_assert_cmpstr(qdict_get_try_str(sub_qdict, long_key + 1), ==, "v");
- QDECREF(qdict);
+ qobject_unref(qdict);
g_free(params);
/* Crap after valid key */
@@ -92,13 +92,13 @@ static void test_keyval_parse(void)
g_assert_cmpuint(qdict_size(qdict), ==, 2);
g_assert_cmpstr(qdict_get_try_str(qdict, "a"), ==, "3");
g_assert_cmpstr(qdict_get_try_str(qdict, "b"), ==, "2,x");
- QDECREF(qdict);
+ qobject_unref(qdict);
/* Even when it doesn't in qemu_opts_parse() */
qdict = keyval_parse("id=foo,id=bar", NULL, &error_abort);
g_assert_cmpuint(qdict_size(qdict), ==, 1);
g_assert_cmpstr(qdict_get_try_str(qdict, "id"), ==, "bar");
- QDECREF(qdict);
+ qobject_unref(qdict);
/* Dotted keys */
qdict = keyval_parse("a.b.c=1,a.b.c=2,d=3", NULL, &error_abort);
@@ -111,7 +111,7 @@ static void test_keyval_parse(void)
g_assert_cmpuint(qdict_size(sub_qdict), ==, 1);
g_assert_cmpstr(qdict_get_try_str(sub_qdict, "c"), ==, "2");
g_assert_cmpstr(qdict_get_try_str(qdict, "d"), ==, "3");
- QDECREF(qdict);
+ qobject_unref(qdict);
/* Inconsistent dotted keys */
qdict = keyval_parse("a.b=1,a=2", NULL, &err);
@@ -125,7 +125,7 @@ static void test_keyval_parse(void)
qdict = keyval_parse("x=y,", NULL, &error_abort);
g_assert_cmpuint(qdict_size(qdict), ==, 1);
g_assert_cmpstr(qdict_get_try_str(qdict, "x"), ==, "y");
- QDECREF(qdict);
+ qobject_unref(qdict);
/* Except when it isn't */
qdict = keyval_parse(",", NULL, &err);
@@ -136,13 +136,13 @@ static void test_keyval_parse(void)
qdict = keyval_parse("x=,,id=bar", NULL, &error_abort);
g_assert_cmpuint(qdict_size(qdict), ==, 1);
g_assert_cmpstr(qdict_get_try_str(qdict, "x"), ==, ",id=bar");
- QDECREF(qdict);
+ qobject_unref(qdict);
/* Anti-social ID is left to caller (qemu_opts_parse() rejects it) */
qdict = keyval_parse("id=666", NULL, &error_abort);
g_assert_cmpuint(qdict_size(qdict), ==, 1);
g_assert_cmpstr(qdict_get_try_str(qdict, "id"), ==, "666");
- QDECREF(qdict);
+ qobject_unref(qdict);
/* Implied value not supported (unlike qemu_opts_parse()) */
qdict = keyval_parse("an,noaus,noaus=", NULL, &err);
@@ -160,7 +160,7 @@ static void test_keyval_parse(void)
g_assert_cmpstr(qdict_get_try_str(qdict, "implied"), ==, "an");
g_assert_cmpstr(qdict_get_try_str(qdict, "aus"), ==, "off");
g_assert_cmpstr(qdict_get_try_str(qdict, "noaus"), ==, "");
- QDECREF(qdict);
+ qobject_unref(qdict);
/* Implied dotted key */
qdict = keyval_parse("val", "eins.zwei", &error_abort);
@@ -169,7 +169,7 @@ static void test_keyval_parse(void)
g_assert(sub_qdict);
g_assert_cmpuint(qdict_size(sub_qdict), ==, 1);
g_assert_cmpstr(qdict_get_try_str(sub_qdict, "zwei"), ==, "val");
- QDECREF(qdict);
+ qobject_unref(qdict);
/* Implied key with empty value (qemu_opts_parse() accepts this) */
qdict = keyval_parse(",", "implied", &err);
@@ -198,7 +198,7 @@ static void check_list012(QList *qlist)
qstr = qobject_to(QString, qlist_pop(qlist));
g_assert(qstr);
g_assert_cmpstr(qstring_get_str(qstr), ==, expected[i]);
- QDECREF(qstr);
+ qobject_unref(qstr);
}
g_assert(qlist_empty(qlist));
}
@@ -218,14 +218,14 @@ static void test_keyval_parse_list(void)
NULL, &error_abort);
g_assert_cmpint(qdict_size(qdict), ==, 1);
check_list012(qdict_get_qlist(qdict, "list"));
- QDECREF(qdict);
+ qobject_unref(qdict);
/* Multiple indexes, last one wins */
qdict = keyval_parse("list.1=goner,list.0=null,list.01=eins,list.2=zwei",
NULL, &error_abort);
g_assert_cmpint(qdict_size(qdict), ==, 1);
check_list012(qdict_get_qlist(qdict, "list"));
- QDECREF(qdict);
+ qobject_unref(qdict);
/* List at deeper nesting */
qdict = keyval_parse("a.list.1=eins,a.list.00=null,a.list.2=zwei",
@@ -234,7 +234,7 @@ static void test_keyval_parse_list(void)
sub_qdict = qdict_get_qdict(qdict, "a");
g_assert_cmpint(qdict_size(sub_qdict), ==, 1);
check_list012(qdict_get_qlist(sub_qdict, "list"));
- QDECREF(qdict);
+ qobject_unref(qdict);
/* Inconsistent dotted keys: both list and dictionary */
qdict = keyval_parse("a.b.c=1,a.b.0=2", NULL, &err);
@@ -262,7 +262,7 @@ static void test_keyval_visit_bool(void)
qdict = keyval_parse("bool1=on,bool2=off", NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_bool(v, "bool1", &b, &error_abort);
g_assert(b);
@@ -274,7 +274,7 @@ static void test_keyval_visit_bool(void)
qdict = keyval_parse("bool1=offer", NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_bool(v, "bool1", &b, &err);
error_free_or_abort(&err);
@@ -292,7 +292,7 @@ static void test_keyval_visit_number(void)
/* Lower limit zero */
qdict = keyval_parse("number1=0", NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_uint64(v, "number1", &u, &error_abort);
g_assert_cmpuint(u, ==, 0);
@@ -304,7 +304,7 @@ static void test_keyval_visit_number(void)
qdict = keyval_parse("number1=18446744073709551615,number2=-1",
NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_uint64(v, "number1", &u, &error_abort);
g_assert_cmphex(u, ==, UINT64_MAX);
@@ -318,7 +318,7 @@ static void test_keyval_visit_number(void)
qdict = keyval_parse("number1=18446744073709551616",
NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_uint64(v, "number1", &u, &err);
error_free_or_abort(&err);
@@ -329,7 +329,7 @@ static void test_keyval_visit_number(void)
qdict = keyval_parse("number1=-18446744073709551616",
NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_uint64(v, "number1", &u, &err);
error_free_or_abort(&err);
@@ -340,7 +340,7 @@ static void test_keyval_visit_number(void)
qdict = keyval_parse("number1=0x2a,number2=052",
NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_uint64(v, "number1", &u, &error_abort);
g_assert_cmpuint(u, ==, 42);
@@ -354,7 +354,7 @@ static void test_keyval_visit_number(void)
qdict = keyval_parse("number1=3.14,number2=08",
NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_uint64(v, "number1", &u, &err);
error_free_or_abort(&err);
@@ -374,7 +374,7 @@ static void test_keyval_visit_size(void)
/* Lower limit zero */
qdict = keyval_parse("sz1=0", NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_size(v, "sz1", &sz, &error_abort);
g_assert_cmpuint(sz, ==, 0);
@@ -390,7 +390,7 @@ static void test_keyval_visit_size(void)
"sz3=9007199254740993",
NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_size(v, "sz1", &sz, &error_abort);
g_assert_cmphex(sz, ==, 0x1fffffffffffff);
@@ -407,7 +407,7 @@ static void test_keyval_visit_size(void)
"sz2=9223372036854775295", /* 7ffffffffffffdff */
NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_size(v, "sz1", &sz, &error_abort);
g_assert_cmphex(sz, ==, 0x7ffffffffffffc00);
@@ -422,7 +422,7 @@ static void test_keyval_visit_size(void)
"sz2=18446744073709550591", /* fffffffffffffbff */
NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_size(v, "sz1", &sz, &error_abort);
g_assert_cmphex(sz, ==, 0xfffffffffffff800);
@@ -437,7 +437,7 @@ static void test_keyval_visit_size(void)
"sz2=18446744073709550592", /* fffffffffffffc00 */
NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_size(v, "sz1", &sz, &err);
error_free_or_abort(&err);
@@ -450,7 +450,7 @@ static void test_keyval_visit_size(void)
qdict = keyval_parse("sz1=8b,sz2=1.5k,sz3=2M,sz4=0.1G,sz5=16777215T",
NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_size(v, "sz1", &sz, &error_abort);
g_assert_cmpuint(sz, ==, 8);
@@ -469,7 +469,7 @@ static void test_keyval_visit_size(void)
/* Beyond limit with suffix */
qdict = keyval_parse("sz1=16777216T", NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_size(v, "sz1", &sz, &err);
error_free_or_abort(&err);
@@ -479,7 +479,7 @@ static void test_keyval_visit_size(void)
/* Trailing crap */
qdict = keyval_parse("sz1=16E,sz2=16Gi", NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_size(v, "sz1", &sz, &err);
error_free_or_abort(&err);
@@ -498,7 +498,7 @@ static void test_keyval_visit_dict(void)
qdict = keyval_parse("a.b.c=1,a.b.c=2,d=3", NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_start_struct(v, "a", NULL, 0, &error_abort);
visit_start_struct(v, "b", NULL, 0, &error_abort);
@@ -516,7 +516,7 @@ static void test_keyval_visit_dict(void)
qdict = keyval_parse("a.b=", NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_start_struct(v, "a", NULL, 0, &error_abort);
visit_type_int(v, "c", &i, &err); /* a.c missing */
@@ -539,7 +539,7 @@ static void test_keyval_visit_list(void)
qdict = keyval_parse("a.0=,a.1=I,a.2.0=II", NULL, &error_abort);
/* TODO empty list */
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_start_list(v, "a", NULL, 0, &error_abort);
visit_type_str(v, NULL, &s, &error_abort);
@@ -562,7 +562,7 @@ static void test_keyval_visit_list(void)
qdict = keyval_parse("a.0=,b.0.0=head", NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_start_list(v, "a", NULL, 0, &error_abort);
visit_check_list(v, &err); /* a[0] unexpected */
@@ -591,7 +591,7 @@ static void test_keyval_visit_optional(void)
qdict = keyval_parse("a.b=1", NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_optional(v, "b", &present);
g_assert(!present); /* b missing */
@@ -627,7 +627,7 @@ static void test_keyval_visit_alternate(void)
*/
qdict = keyval_parse("a=1,b=2,c=on", NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_AltStrObj(v, "a", &aso, &error_abort);
g_assert_cmpint(aso->type, ==, QTYPE_QSTRING);
@@ -651,19 +651,19 @@ static void test_keyval_visit_any(void)
qdict = keyval_parse("a.0=null,a.1=1", NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
- QDECREF(qdict);
+ qobject_unref(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_any(v, "a", &any, &error_abort);
qlist = qobject_to(QList, any);
g_assert(qlist);
qstr = qobject_to(QString, qlist_pop(qlist));
g_assert_cmpstr(qstring_get_str(qstr), ==, "null");
- QDECREF(qstr);
+ qobject_unref(qstr);
qstr = qobject_to(QString, qlist_pop(qlist));
g_assert_cmpstr(qstring_get_str(qstr), ==, "1");
g_assert(qlist_empty(qlist));
- QDECREF(qstr);
- qobject_decref(any);
+ qobject_unref(qstr);
+ qobject_unref(any);
visit_check_struct(v, &error_abort);
visit_end_struct(v, NULL);
visit_free(v);
diff --git a/tests/test-netfilter.c b/tests/test-netfilter.c
index 95f7839..e47075d 100644
--- a/tests/test-netfilter.c
+++ b/tests/test-netfilter.c
@@ -29,7 +29,7 @@ static void add_one_netfilter(void)
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
response = qmp("{'execute': 'object-del',"
" 'arguments': {"
@@ -37,7 +37,7 @@ static void add_one_netfilter(void)
"}}");
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
}
/* add a netfilter to a netdev and then remove the netdev */
@@ -57,7 +57,7 @@ static void remove_netdev_with_one_netfilter(void)
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
response = qmp("{'execute': 'netdev_del',"
" 'arguments': {"
@@ -65,7 +65,7 @@ static void remove_netdev_with_one_netfilter(void)
"}}");
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
/* add back the netdev */
response = qmp("{'execute': 'netdev_add',"
@@ -75,7 +75,7 @@ static void remove_netdev_with_one_netfilter(void)
"}}");
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
}
/* add multi(2) netfilters to a netdev and then remove them */
@@ -95,7 +95,7 @@ static void add_multi_netfilter(void)
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
response = qmp("{'execute': 'object-add',"
" 'arguments': {"
@@ -109,7 +109,7 @@ static void add_multi_netfilter(void)
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
response = qmp("{'execute': 'object-del',"
" 'arguments': {"
@@ -117,7 +117,7 @@ static void add_multi_netfilter(void)
"}}");
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
response = qmp("{'execute': 'object-del',"
" 'arguments': {"
@@ -125,7 +125,7 @@ static void add_multi_netfilter(void)
"}}");
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
}
/* add multi(2) netfilters to a netdev and then remove the netdev */
@@ -145,7 +145,7 @@ static void remove_netdev_with_multi_netfilter(void)
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
response = qmp("{'execute': 'object-add',"
" 'arguments': {"
@@ -159,7 +159,7 @@ static void remove_netdev_with_multi_netfilter(void)
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
response = qmp("{'execute': 'netdev_del',"
" 'arguments': {"
@@ -167,7 +167,7 @@ static void remove_netdev_with_multi_netfilter(void)
"}}");
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
/* add back the netdev */
response = qmp("{'execute': 'netdev_add',"
@@ -177,7 +177,7 @@ static void remove_netdev_with_multi_netfilter(void)
"}}");
g_assert(response);
g_assert(!qdict_haskey(response, "error"));
- QDECREF(response);
+ qobject_unref(response);
}
int main(int argc, char **argv)
diff --git a/tests/test-qemu-opts.c b/tests/test-qemu-opts.c
index 2c422ab..77dd72b 100644
--- a/tests/test-qemu-opts.c
+++ b/tests/test-qemu-opts.c
@@ -887,7 +887,7 @@ static void test_opts_to_qdict_basic(void)
g_assert_cmpstr(qdict_get_str(dict, "number1"), ==, "42");
g_assert_false(qdict_haskey(dict, "number2"));
- QDECREF(dict);
+ qobject_unref(dict);
qemu_opts_del(opts);
}
@@ -914,7 +914,7 @@ static void test_opts_to_qdict_filtered(void)
g_assert_cmpstr(qdict_get_str(dict, "number1"), ==, "42");
g_assert_false(qdict_haskey(dict, "number2"));
g_assert_false(qdict_haskey(dict, "bool1"));
- QDECREF(dict);
+ qobject_unref(dict);
dict = qemu_opts_to_qdict_filtered(opts, NULL, &opts_list_02, false);
g_assert(dict != NULL);
@@ -924,7 +924,7 @@ static void test_opts_to_qdict_filtered(void)
g_assert_false(qdict_haskey(dict, "str3"));
g_assert_false(qdict_haskey(dict, "number1"));
g_assert_false(qdict_haskey(dict, "number2"));
- QDECREF(dict);
+ qobject_unref(dict);
/* Now delete converted options from opts */
dict = qemu_opts_to_qdict_filtered(opts, NULL, &opts_list_01, true);
@@ -935,7 +935,7 @@ static void test_opts_to_qdict_filtered(void)
g_assert_cmpstr(qdict_get_str(dict, "number1"), ==, "42");
g_assert_false(qdict_haskey(dict, "number2"));
g_assert_false(qdict_haskey(dict, "bool1"));
- QDECREF(dict);
+ qobject_unref(dict);
dict = qemu_opts_to_qdict_filtered(opts, NULL, &opts_list_02, true);
g_assert(dict != NULL);
@@ -945,7 +945,7 @@ static void test_opts_to_qdict_filtered(void)
g_assert_false(qdict_haskey(dict, "str3"));
g_assert_false(qdict_haskey(dict, "number1"));
g_assert_false(qdict_haskey(dict, "number2"));
- QDECREF(dict);
+ qobject_unref(dict);
g_assert_true(QTAILQ_EMPTY(&opts->head));
@@ -978,13 +978,13 @@ static void test_opts_to_qdict_duplicates(void)
dict = qemu_opts_to_qdict(opts, NULL);
g_assert(dict != NULL);
g_assert_cmpstr(qdict_get_str(dict, "foo"), ==, "b");
- QDECREF(dict);
+ qobject_unref(dict);
/* The last one still wins if entries are deleted, and both are deleted */
dict = qemu_opts_to_qdict_filtered(opts, NULL, NULL, true);
g_assert(dict != NULL);
g_assert_cmpstr(qdict_get_str(dict, "foo"), ==, "b");
- QDECREF(dict);
+ qobject_unref(dict);
g_assert_true(QTAILQ_EMPTY(&opts->head));
diff --git a/tests/test-qga.c b/tests/test-qga.c
index e6ab788..18e63cb 100644
--- a/tests/test-qga.c
+++ b/tests/test-qga.c
@@ -180,7 +180,7 @@ static void test_qga_sync_delimited(gconstpointer fix)
v = qdict_get_int(ret, "return");
g_assert_cmpint(r, ==, v);
- QDECREF(ret);
+ qobject_unref(ret);
}
static void test_qga_sync(gconstpointer fix)
@@ -212,7 +212,7 @@ static void test_qga_sync(gconstpointer fix)
v = qdict_get_int(ret, "return");
g_assert_cmpint(r, ==, v);
- QDECREF(ret);
+ qobject_unref(ret);
}
static void test_qga_ping(gconstpointer fix)
@@ -224,7 +224,7 @@ static void test_qga_ping(gconstpointer fix)
g_assert_nonnull(ret);
qmp_assert_no_error(ret);
- QDECREF(ret);
+ qobject_unref(ret);
}
static void test_qga_invalid_args(gconstpointer fix)
@@ -244,7 +244,7 @@ static void test_qga_invalid_args(gconstpointer fix)
g_assert_cmpstr(class, ==, "GenericError");
g_assert_cmpstr(desc, ==, "Parameter 'foo' is unexpected");
- QDECREF(ret);
+ qobject_unref(ret);
}
static void test_qga_invalid_cmd(gconstpointer fix)
@@ -263,7 +263,7 @@ static void test_qga_invalid_cmd(gconstpointer fix)
g_assert_cmpstr(class, ==, "CommandNotFound");
g_assert_cmpint(strlen(desc), >, 0);
- QDECREF(ret);
+ qobject_unref(ret);
}
static void test_qga_info(gconstpointer fix)
@@ -280,7 +280,7 @@ static void test_qga_info(gconstpointer fix)
version = qdict_get_try_str(val, "version");
g_assert_cmpstr(version, ==, QEMU_VERSION);
- QDECREF(ret);
+ qobject_unref(ret);
}
static void test_qga_get_vcpus(gconstpointer fix)
@@ -300,7 +300,7 @@ static void test_qga_get_vcpus(gconstpointer fix)
g_assert(qdict_haskey(qobject_to(QDict, entry->value), "online"));
g_assert(qdict_haskey(qobject_to(QDict, entry->value), "logical-id"));
- QDECREF(ret);
+ qobject_unref(ret);
}
static void test_qga_get_fsinfo(gconstpointer fix)
@@ -324,7 +324,7 @@ static void test_qga_get_fsinfo(gconstpointer fix)
g_assert(qdict_haskey(qobject_to(QDict, entry->value), "disk"));
}
- QDECREF(ret);
+ qobject_unref(ret);
}
static void test_qga_get_memory_block_info(gconstpointer fix)
@@ -344,7 +344,7 @@ static void test_qga_get_memory_block_info(gconstpointer fix)
g_assert_cmpint(size, >, 0);
}
- QDECREF(ret);
+ qobject_unref(ret);
}
static void test_qga_get_memory_blocks(gconstpointer fix)
@@ -369,7 +369,7 @@ static void test_qga_get_memory_blocks(gconstpointer fix)
}
}
- QDECREF(ret);
+ qobject_unref(ret);
}
static void test_qga_network_get_interfaces(gconstpointer fix)
@@ -388,7 +388,7 @@ static void test_qga_network_get_interfaces(gconstpointer fix)
entry = qlist_first(list);
g_assert(qdict_haskey(qobject_to(QDict, entry->value), "name"));
- QDECREF(ret);
+ qobject_unref(ret);
}
static void test_qga_file_ops(gconstpointer fix)
@@ -410,7 +410,7 @@ static void test_qga_file_ops(gconstpointer fix)
g_assert_nonnull(ret);
qmp_assert_no_error(ret);
id = qdict_get_int(ret, "return");
- QDECREF(ret);
+ qobject_unref(ret);
enc = g_base64_encode(helloworld, sizeof(helloworld));
/* write */
@@ -426,7 +426,7 @@ static void test_qga_file_ops(gconstpointer fix)
eof = qdict_get_bool(val, "eof");
g_assert_cmpint(count, ==, sizeof(helloworld));
g_assert_cmpint(eof, ==, 0);
- QDECREF(ret);
+ qobject_unref(ret);
g_free(cmd);
/* flush */
@@ -434,7 +434,7 @@ static void test_qga_file_ops(gconstpointer fix)
" 'arguments': {'handle': %" PRId64 "} }",
id);
ret = qmp_fd(fixture->fd, cmd);
- QDECREF(ret);
+ qobject_unref(ret);
g_free(cmd);
/* close */
@@ -442,7 +442,7 @@ static void test_qga_file_ops(gconstpointer fix)
" 'arguments': {'handle': %" PRId64 "} }",
id);
ret = qmp_fd(fixture->fd, cmd);
- QDECREF(ret);
+ qobject_unref(ret);
g_free(cmd);
/* check content */
@@ -462,7 +462,7 @@ static void test_qga_file_ops(gconstpointer fix)
g_assert_nonnull(ret);
qmp_assert_no_error(ret);
id = qdict_get_int(ret, "return");
- QDECREF(ret);
+ qobject_unref(ret);
/* read */
cmd = g_strdup_printf("{'execute': 'guest-file-read',"
@@ -477,7 +477,7 @@ static void test_qga_file_ops(gconstpointer fix)
g_assert(eof);
g_assert_cmpstr(b64, ==, enc);
- QDECREF(ret);
+ qobject_unref(ret);
g_free(cmd);
g_free(enc);
@@ -493,7 +493,7 @@ static void test_qga_file_ops(gconstpointer fix)
g_assert_cmpint(count, ==, 0);
g_assert(eof);
g_assert_cmpstr(b64, ==, "");
- QDECREF(ret);
+ qobject_unref(ret);
g_free(cmd);
/* seek */
@@ -508,7 +508,7 @@ static void test_qga_file_ops(gconstpointer fix)
eof = qdict_get_bool(val, "eof");
g_assert_cmpint(count, ==, 6);
g_assert(!eof);
- QDECREF(ret);
+ qobject_unref(ret);
g_free(cmd);
/* partial read */
@@ -527,7 +527,7 @@ static void test_qga_file_ops(gconstpointer fix)
g_assert_cmpmem(dec, count, helloworld + 6, sizeof(helloworld) - 6);
g_free(dec);
- QDECREF(ret);
+ qobject_unref(ret);
g_free(cmd);
/* close */
@@ -535,7 +535,7 @@ static void test_qga_file_ops(gconstpointer fix)
" 'arguments': {'handle': %" PRId64 "} }",
id);
ret = qmp_fd(fixture->fd, cmd);
- QDECREF(ret);
+ qobject_unref(ret);
g_free(cmd);
}
@@ -555,7 +555,7 @@ static void test_qga_file_write_read(gconstpointer fix)
g_assert_nonnull(ret);
qmp_assert_no_error(ret);
id = qdict_get_int(ret, "return");
- QDECREF(ret);
+ qobject_unref(ret);
enc = g_base64_encode(helloworld, sizeof(helloworld));
/* write */
@@ -571,7 +571,7 @@ static void test_qga_file_write_read(gconstpointer fix)
eof = qdict_get_bool(val, "eof");
g_assert_cmpint(count, ==, sizeof(helloworld));
g_assert_cmpint(eof, ==, 0);
- QDECREF(ret);
+ qobject_unref(ret);
g_free(cmd);
/* read (check implicit flush) */
@@ -586,7 +586,7 @@ static void test_qga_file_write_read(gconstpointer fix)
g_assert_cmpint(count, ==, 0);
g_assert(eof);
g_assert_cmpstr(b64, ==, "");
- QDECREF(ret);
+ qobject_unref(ret);
g_free(cmd);
/* seek to 0 */
@@ -601,7 +601,7 @@ static void test_qga_file_write_read(gconstpointer fix)
eof = qdict_get_bool(val, "eof");
g_assert_cmpint(count, ==, 0);
g_assert(!eof);
- QDECREF(ret);
+ qobject_unref(ret);
g_free(cmd);
/* read */
@@ -616,7 +616,7 @@ static void test_qga_file_write_read(gconstpointer fix)
g_assert_cmpint(count, ==, sizeof(helloworld));
g_assert(eof);
g_assert_cmpstr(b64, ==, enc);
- QDECREF(ret);
+ qobject_unref(ret);
g_free(cmd);
g_free(enc);
@@ -625,7 +625,7 @@ static void test_qga_file_write_read(gconstpointer fix)
" 'arguments': {'handle': %" PRId64 "} }",
id);
ret = qmp_fd(fixture->fd, cmd);
- QDECREF(ret);
+ qobject_unref(ret);
g_free(cmd);
}
@@ -642,7 +642,7 @@ static void test_qga_get_time(gconstpointer fix)
time = qdict_get_int(ret, "return");
g_assert_cmpint(time, >, 0);
- QDECREF(ret);
+ qobject_unref(ret);
}
static void test_qga_blacklist(gconstpointer data)
@@ -661,7 +661,7 @@ static void test_qga_blacklist(gconstpointer data)
desc = qdict_get_try_str(error, "desc");
g_assert_cmpstr(class, ==, "GenericError");
g_assert_nonnull(g_strstr_len(desc, -1, "has been disabled"));
- QDECREF(ret);
+ qobject_unref(ret);
ret = qmp_fd(fix.fd, "{'execute': 'guest-get-time'}");
g_assert_nonnull(ret);
@@ -670,12 +670,12 @@ static void test_qga_blacklist(gconstpointer data)
desc = qdict_get_try_str(error, "desc");
g_assert_cmpstr(class, ==, "GenericError");
g_assert_nonnull(g_strstr_len(desc, -1, "has been disabled"));
- QDECREF(ret);
+ qobject_unref(ret);
/* check something work */
ret = qmp_fd(fix.fd, "{'execute': 'guest-get-fsinfo'}");
qmp_assert_no_error(ret);
- QDECREF(ret);
+ qobject_unref(ret);
fixture_tear_down(&fix, NULL);
}
@@ -772,7 +772,7 @@ static void test_qga_fsfreeze_status(gconstpointer fix)
status = qdict_get_try_str(ret, "return");
g_assert_cmpstr(status, ==, "thawed");
- QDECREF(ret);
+ qobject_unref(ret);
}
static void test_qga_guest_exec(gconstpointer fix)
@@ -795,7 +795,7 @@ static void test_qga_guest_exec(gconstpointer fix)
val = qdict_get_qdict(ret, "return");
pid = qdict_get_int(val, "pid");
g_assert_cmpint(pid, >, 0);
- QDECREF(ret);
+ qobject_unref(ret);
/* wait for completion */
now = g_get_monotonic_time();
@@ -807,7 +807,7 @@ static void test_qga_guest_exec(gconstpointer fix)
val = qdict_get_qdict(ret, "return");
exited = qdict_get_bool(val, "exited");
if (!exited) {
- QDECREF(ret);
+ qobject_unref(ret);
}
} while (!exited &&
g_get_monotonic_time() < now + 5 * G_TIME_SPAN_SECOND);
@@ -822,7 +822,7 @@ static void test_qga_guest_exec(gconstpointer fix)
g_assert_cmpint(len, ==, 12);
g_assert_cmpstr((char *)decoded, ==, "\" test_str \"");
g_free(decoded);
- QDECREF(ret);
+ qobject_unref(ret);
}
static void test_qga_guest_exec_invalid(gconstpointer fix)
@@ -841,7 +841,7 @@ static void test_qga_guest_exec_invalid(gconstpointer fix)
desc = qdict_get_str(error, "desc");
g_assert_cmpstr(class, ==, "GenericError");
g_assert_cmpint(strlen(desc), >, 0);
- QDECREF(ret);
+ qobject_unref(ret);
/* invalid pid */
ret = qmp_fd(fixture->fd, "{'execute': 'guest-exec-status',"
@@ -853,7 +853,7 @@ static void test_qga_guest_exec_invalid(gconstpointer fix)
desc = qdict_get_str(error, "desc");
g_assert_cmpstr(class, ==, "GenericError");
g_assert_cmpint(strlen(desc), >, 0);
- QDECREF(ret);
+ qobject_unref(ret);
}
static void test_qga_guest_get_osinfo(gconstpointer data)
@@ -905,7 +905,7 @@ static void test_qga_guest_get_osinfo(gconstpointer data)
g_assert_nonnull(str);
g_assert_cmpstr(str, ==, "unit-test");
- QDECREF(ret);
+ qobject_unref(ret);
g_free(env[0]);
fixture_tear_down(&fixture, NULL);
}
diff --git a/tests/test-qmp-cmds.c b/tests/test-qmp-cmds.c
index db690cc..e0ed461 100644
--- a/tests/test-qmp-cmds.c
+++ b/tests/test-qmp-cmds.c
@@ -106,8 +106,8 @@ static void test_dispatch_cmd(void)
assert(resp != NULL);
assert(!qdict_haskey(qobject_to(QDict, resp), "error"));
- qobject_decref(resp);
- QDECREF(req);
+ qobject_unref(resp);
+ qobject_unref(req);
}
/* test commands that return an error due to invalid parameters */
@@ -123,8 +123,8 @@ static void test_dispatch_cmd_failure(void)
assert(resp != NULL);
assert(qdict_haskey(qobject_to(QDict, resp), "error"));
- qobject_decref(resp);
- QDECREF(req);
+ qobject_unref(resp);
+ qobject_unref(req);
/* check that with extra arguments it throws an error */
req = qdict_new();
@@ -137,8 +137,8 @@ static void test_dispatch_cmd_failure(void)
assert(resp != NULL);
assert(qdict_haskey(qobject_to(QDict, resp), "error"));
- qobject_decref(resp);
- QDECREF(req);
+ qobject_unref(resp);
+ qobject_unref(req);
}
static QObject *test_qmp_dispatch(QDict *req)
@@ -153,8 +153,8 @@ static QObject *test_qmp_dispatch(QDict *req)
assert(resp && !qdict_haskey(resp, "error"));
ret = qdict_get(resp, "return");
assert(ret);
- qobject_incref(ret);
- qobject_decref(resp_obj);
+ qobject_ref(ret);
+ qobject_unref(resp_obj);
return ret;
}
@@ -195,7 +195,7 @@ static void test_dispatch_cmd_io(void)
assert(qdict_get_int(ret_dict_dict2_userdef, "integer") == 422);
assert(!strcmp(qdict_get_str(ret_dict_dict2_userdef, "string"), "hello2"));
assert(!strcmp(qdict_get_str(ret_dict_dict2, "string"), "blah4"));
- QDECREF(ret);
+ qobject_unref(ret);
qdict_put_int(args3, "a", 66);
qdict_put(req, "arguments", args3);
@@ -204,9 +204,9 @@ static void test_dispatch_cmd_io(void)
ret3 = qobject_to(QNum, test_qmp_dispatch(req));
g_assert(qnum_get_try_int(ret3, &val));
g_assert_cmpint(val, ==, 66);
- QDECREF(ret3);
+ qobject_unref(ret3);
- QDECREF(req);
+ qobject_unref(req);
}
/* test generated dealloc functions for generated types */
@@ -257,7 +257,7 @@ static void test_dealloc_partial(void)
v = qobject_input_visitor_new(QOBJECT(ud2_dict));
visit_type_UserDefTwo(v, NULL, &ud2, &err);
visit_free(v);
- QDECREF(ud2_dict);
+ qobject_unref(ud2_dict);
}
/* verify that visit_type_XXX() cleans up properly on error */
diff --git a/tests/test-qmp-event.c b/tests/test-qmp-event.c
index bb10366..3a7c227 100644
--- a/tests/test-qmp-event.c
+++ b/tests/test-qmp-event.c
@@ -133,7 +133,7 @@ static void event_prepare(TestEventData *data,
static void event_teardown(TestEventData *data,
const void *unused)
{
- QDECREF(data->expect);
+ qobject_unref(data->expect);
test_event_data = NULL;
g_mutex_unlock(&test_event_lock);
diff --git a/tests/test-qobject-input-visitor.c b/tests/test-qobject-input-visitor.c
index 6dc59c6..0f4d234 100644
--- a/tests/test-qobject-input-visitor.c
+++ b/tests/test-qobject-input-visitor.c
@@ -35,7 +35,7 @@ typedef struct TestInputVisitorData {
static void visitor_input_teardown(TestInputVisitorData *data,
const void *unused)
{
- qobject_decref(data->obj);
+ qobject_unref(data->obj);
data->obj = NULL;
if (data->qiv) {
@@ -483,7 +483,7 @@ static void test_visitor_in_any(TestInputVisitorData *data,
g_assert(qnum);
g_assert(qnum_get_try_int(qnum, &val));
g_assert_cmpint(val, ==, -42);
- qobject_decref(res);
+ qobject_unref(res);
v = visitor_input_test_init(data, "{ 'integer': -42, 'boolean': true, 'string': 'foo' }");
visit_type_any(v, NULL, &res, &error_abort);
@@ -505,7 +505,7 @@ static void test_visitor_in_any(TestInputVisitorData *data,
qstring = qobject_to(QString, qobj);
g_assert(qstring);
g_assert_cmpstr(qstring_get_str(qstring), ==, "foo");
- qobject_decref(res);
+ qobject_unref(res);
}
static void test_visitor_in_null(TestInputVisitorData *data,
@@ -530,7 +530,7 @@ static void test_visitor_in_null(TestInputVisitorData *data,
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_null(v, "a", &null, &error_abort);
g_assert(qobject_type(QOBJECT(null)) == QTYPE_QNULL);
- QDECREF(null);
+ qobject_unref(null);
visit_type_null(v, "b", &null, &err);
error_free_or_abort(&err);
g_assert(!null);
@@ -1262,7 +1262,7 @@ static void do_test_visitor_in_qmp_introspect(TestInputVisitorData *data,
g_assert(schema);
qapi_free_SchemaInfoList(schema);
- qobject_decref(obj);
+ qobject_unref(obj);
visit_free(v);
}
diff --git a/tests/test-qobject-output-visitor.c b/tests/test-qobject-output-visitor.c
index ecf21c0..be63585 100644
--- a/tests/test-qobject-output-visitor.c
+++ b/tests/test-qobject-output-visitor.c
@@ -40,7 +40,7 @@ static void visitor_output_teardown(TestOutputVisitorData *data,
{
visit_free(data->ov);
data->ov = NULL;
- qobject_decref(data->obj);
+ qobject_unref(data->obj);
data->obj = NULL;
}
@@ -346,7 +346,7 @@ static void test_visitor_out_any(TestOutputVisitorData *data,
g_assert(qnum);
g_assert(qnum_get_try_int(qnum, &val));
g_assert_cmpint(val, ==, -42);
- qobject_decref(qobj);
+ qobject_unref(qobj);
visitor_reset(data);
qdict = qdict_new();
@@ -355,7 +355,7 @@ static void test_visitor_out_any(TestOutputVisitorData *data,
qdict_put_str(qdict, "string", "foo");
qobj = QOBJECT(qdict);
visit_type_any(data->ov, NULL, &qobj, &error_abort);
- qobject_decref(qobj);
+ qobject_unref(qobj);
qdict = qobject_to(QDict, visitor_get(data));
g_assert(qdict);
qnum = qobject_to(QNum, qdict_get(qdict, "integer"));
@@ -630,7 +630,7 @@ static void check_native_list(QObject *qobj,
qvalue = qobject_to(QNum, tmp);
g_assert(qnum_get_try_uint(qvalue, &val));
g_assert_cmpint(val, ==, i);
- qobject_decref(qlist_pop(qlist));
+ qobject_unref(qlist_pop(qlist));
}
break;
@@ -654,7 +654,7 @@ static void check_native_list(QObject *qobj,
qvalue = qobject_to(QNum, tmp);
g_assert(qnum_get_try_int(qvalue, &val));
g_assert_cmpint(val, ==, i);
- qobject_decref(qlist_pop(qlist));
+ qobject_unref(qlist_pop(qlist));
}
break;
case USER_DEF_NATIVE_LIST_UNION_KIND_BOOLEAN:
@@ -665,7 +665,7 @@ static void check_native_list(QObject *qobj,
g_assert(tmp);
qvalue = qobject_to(QBool, tmp);
g_assert_cmpint(qbool_get_bool(qvalue), ==, i % 3 == 0);
- qobject_decref(qlist_pop(qlist));
+ qobject_unref(qlist_pop(qlist));
}
break;
case USER_DEF_NATIVE_LIST_UNION_KIND_STRING:
@@ -678,7 +678,7 @@ static void check_native_list(QObject *qobj,
qvalue = qobject_to(QString, tmp);
sprintf(str, "%d", i);
g_assert_cmpstr(qstring_get_str(qvalue), ==, str);
- qobject_decref(qlist_pop(qlist));
+ qobject_unref(qlist_pop(qlist));
}
break;
case USER_DEF_NATIVE_LIST_UNION_KIND_NUMBER:
@@ -695,7 +695,7 @@ static void check_native_list(QObject *qobj,
g_string_printf(double_actual, "%.6f", qnum_get_double(qvalue));
g_assert_cmpstr(double_actual->str, ==, double_expected->str);
- qobject_decref(qlist_pop(qlist));
+ qobject_unref(qlist_pop(qlist));
g_string_free(double_expected, true);
g_string_free(double_actual, true);
}
@@ -703,7 +703,7 @@ static void check_native_list(QObject *qobj,
default:
g_assert_not_reached();
}
- QDECREF(qlist);
+ qobject_unref(qlist);
}
static void test_native_list(TestOutputVisitorData *data,
diff --git a/tests/test-visitor-serialization.c b/tests/test-visitor-serialization.c
index d18d90d..1c5a8b9 100644
--- a/tests/test-visitor-serialization.c
+++ b/tests/test-visitor-serialization.c
@@ -1036,10 +1036,10 @@ static void qmp_deserialize(void **native_out, void *datap,
output_json = qobject_to_json(obj_orig);
obj = qobject_from_json(qstring_get_str(output_json), &error_abort);
- QDECREF(output_json);
+ qobject_unref(output_json);
d->qiv = qobject_input_visitor_new(obj);
- qobject_decref(obj_orig);
- qobject_decref(obj);
+ qobject_unref(obj_orig);
+ qobject_unref(obj);
visit(d->qiv, native_out, errp);
}
diff --git a/tests/test-x86-cpuid-compat.c b/tests/test-x86-cpuid-compat.c
index 02e4184..84ce9c7 100644
--- a/tests/test-x86-cpuid-compat.c
+++ b/tests/test-x86-cpuid-compat.c
@@ -19,7 +19,7 @@ static char *get_cpu0_qom_path(void)
cpu0 = qobject_to(QDict, qlist_peek(ret));
path = g_strdup(qdict_get_str(cpu0, "qom_path"));
- QDECREF(resp);
+ qobject_unref(resp);
return path;
}
@@ -30,8 +30,8 @@ static QObject *qom_get(const char *path, const char *prop)
" 'property': %s } }",
path, prop);
QObject *ret = qdict_get(resp, "return");
- qobject_incref(ret);
- QDECREF(resp);
+ qobject_ref(ret);
+ qobject_unref(resp);
return ret;
}
@@ -41,7 +41,7 @@ static bool qom_get_bool(const char *path, const char *prop)
QBool *value = qobject_to(QBool, qom_get(path, prop));
bool b = qbool_get_bool(value);
- QDECREF(value);
+ qobject_unref(value);
return b;
}
#endif
@@ -66,7 +66,7 @@ static void test_cpuid_prop(const void *data)
g_assert_cmpint(val, ==, args->expected_value);
qtest_end();
- QDECREF(value);
+ qobject_unref(value);
g_free(path);
}
@@ -142,8 +142,8 @@ static void test_feature_flag(const void *data)
g_assert(!!(value & (1U << args->bitnr)) == args->expected_value);
- QDECREF(present);
- QDECREF(filtered);
+ qobject_unref(present);
+ qobject_unref(filtered);
g_free(path);
}
diff --git a/tests/tmp105-test.c b/tests/tmp105-test.c
index 66c7a01..d093cff 100644
--- a/tests/tmp105-test.c
+++ b/tests/tmp105-test.c
@@ -74,7 +74,7 @@ static int qmp_tmp105_get_temperature(const char *id)
"'property': 'temperature' } }", id);
g_assert(qdict_haskey(response, "return"));
ret = qdict_get_int(response, "return");
- QDECREF(response);
+ qobject_unref(response);
return ret;
}
@@ -85,7 +85,7 @@ static void qmp_tmp105_set_temperature(const char *id, int value)
response = qmp("{ 'execute': 'qom-set', 'arguments': { 'path': %s, "
"'property': 'temperature', 'value': %d } }", id, value);
g_assert(qdict_haskey(response, "return"));
- QDECREF(response);
+ qobject_unref(response);
}
#define TMP105_PRECISION (1000/16)
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 61d9972..bbc8091 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -727,7 +727,7 @@ static void test_migrate(void)
rsp = qmp("{ 'execute': 'migrate_set_speed',"
"'arguments': { 'value': 10 } }");
g_assert(qdict_haskey(rsp, "return"));
- QDECREF(rsp);
+ qobject_unref(rsp);
cmd = g_strdup_printf("{ 'execute': 'migrate',"
"'arguments': { 'uri': '%s' } }",
@@ -735,7 +735,7 @@ static void test_migrate(void)
rsp = qmp(cmd);
g_free(cmd);
g_assert(qdict_haskey(rsp, "return"));
- QDECREF(rsp);
+ qobject_unref(rsp);
wait_for_log_fd(s);
@@ -751,7 +751,7 @@ static void test_migrate(void)
rsp = qmp("{ 'execute': 'migrate_set_speed',"
"'arguments': { 'value': 0 } }");
g_assert(qdict_haskey(rsp, "return"));
- QDECREF(rsp);
+ qobject_unref(rsp);
qmp_eventwait("STOP");
diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c
index 0a3c5dd..b285a26 100644
--- a/tests/virtio-net-test.c
+++ b/tests/virtio-net-test.c
@@ -173,7 +173,7 @@ static void rx_stop_cont_test(QVirtioDevice *dev,
qvirtqueue_kick(dev, vq, free_head);
rsp = qmp("{ 'execute' : 'stop'}");
- QDECREF(rsp);
+ qobject_unref(rsp);
ret = iov_send(socket, iov, 2, 0, sizeof(len) + sizeof(test));
g_assert_cmpint(ret, ==, sizeof(test) + sizeof(len));
@@ -182,9 +182,9 @@ static void rx_stop_cont_test(QVirtioDevice *dev,
* ensure the packet data gets queued in QEMU, before we do 'cont'.
*/
rsp = qmp("{ 'execute' : 'query-status'}");
- QDECREF(rsp);
+ qobject_unref(rsp);
rsp = qmp("{ 'execute' : 'cont'}");
- QDECREF(rsp);
+ qobject_unref(rsp);
qvirtio_wait_used_elem(dev, vq, free_head, NULL, QVIRTIO_NET_TIMEOUT_US);
memread(req_addr + VNET_HDR_SIZE, buffer, sizeof(test));
diff --git a/tests/vmgenid-test.c b/tests/vmgenid-test.c
index 2ec274e..8d915c6 100644
--- a/tests/vmgenid-test.c
+++ b/tests/vmgenid-test.c
@@ -125,7 +125,7 @@ static void read_guid_from_monitor(QemuUUID *guid)
guid_str = qdict_get_str(rsp_ret, "guid");
g_assert(qemu_uuid_parse(guid_str, guid) == 0);
}
- QDECREF(rsp);
+ qobject_unref(rsp);
}
static char disk[] = "tests/vmgenid-test-disk-XXXXXX";
diff --git a/tests/wdt_ib700-test.c b/tests/wdt_ib700-test.c
index 3b5bbcf..797288d 100644
--- a/tests/wdt_ib700-test.c
+++ b/tests/wdt_ib700-test.c
@@ -16,7 +16,7 @@ static void qmp_check_no_event(QTestState *s)
{
QDict *resp = qtest_qmp(s, "{'execute':'query-status'}");
g_assert(qdict_haskey(resp, "return"));
- QDECREF(resp);
+ qobject_unref(resp);
}
static QDict *ib700_program_and_wait(QTestState *s)
@@ -48,8 +48,8 @@ static QDict *ib700_program_and_wait(QTestState *s)
qtest_clock_step(s, 2 * NANOSECONDS_PER_SECOND);
event = qtest_qmp_eventwait_ref(s, "WATCHDOG");
data = qdict_get_qdict(event, "data");
- QINCREF(data);
- QDECREF(event);
+ qobject_ref(data);
+ qobject_unref(event);
return data;
}
@@ -62,7 +62,7 @@ static void ib700_pause(void)
qtest_irq_intercept_in(s, "ioapic");
d = ib700_program_and_wait(s);
g_assert(!strcmp(qdict_get_str(d, "action"), "pause"));
- QDECREF(d);
+ qobject_unref(d);
qtest_qmp_eventwait(s, "STOP");
qtest_quit(s);
}
@@ -75,7 +75,7 @@ static void ib700_reset(void)
qtest_irq_intercept_in(s, "ioapic");
d = ib700_program_and_wait(s);
g_assert(!strcmp(qdict_get_str(d, "action"), "reset"));
- QDECREF(d);
+ qobject_unref(d);
qtest_qmp_eventwait(s, "RESET");
qtest_quit(s);
}
@@ -89,7 +89,7 @@ static void ib700_shutdown(void)
qtest_irq_intercept_in(s, "ioapic");
d = ib700_program_and_wait(s);
g_assert(!strcmp(qdict_get_str(d, "action"), "reset"));
- QDECREF(d);
+ qobject_unref(d);
qtest_qmp_eventwait(s, "SHUTDOWN");
qtest_quit(s);
}
@@ -102,7 +102,7 @@ static void ib700_none(void)
qtest_irq_intercept_in(s, "ioapic");
d = ib700_program_and_wait(s);
g_assert(!strcmp(qdict_get_str(d, "action"), "none"));
- QDECREF(d);
+ qobject_unref(d);
qtest_quit(s);
}