qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

qobject: Replace qobject_incref/QINCREF qobject_decref/QDECREF

Now that we can safely call QOBJECT() on QObject * as well as its
subtypes, we can have macros qobject_ref() / qobject_unref() that work
everywhere instead of having to use QINCREF() / QDECREF() for QObject
and qobject_incref() / qobject_decref() for its subtypes.

The replacement is mechanical, except I broke a long line, and added a
cast in monitor_qmp_cleanup_req_queue_locked(). Unlike
qobject_decref(), qobject_unref() doesn't accept void *.

Note that the new macros evaluate their argument exactly once, thus no
need to shout them.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20180419150145.24795-4-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Rebased, semantic conflict resolved, commit message improved]
Signed-off-by: Markus Armbruster <armbru@redhat.com>

authored by

Marc-André Lureau and committed by
Markus Armbruster
cb3e7f08 3d3eacae

+609 -613
+39 -39
block.c
··· 1227 1227 1228 1228 ret = bdrv_open_driver(bs, drv, node_name, bs->options, flags, errp); 1229 1229 if (ret < 0) { 1230 - QDECREF(bs->explicit_options); 1230 + qobject_unref(bs->explicit_options); 1231 1231 bs->explicit_options = NULL; 1232 - QDECREF(bs->options); 1232 + qobject_unref(bs->options); 1233 1233 bs->options = NULL; 1234 1234 bdrv_unref(bs); 1235 1235 return NULL; ··· 1460 1460 1461 1461 options = qobject_to(QDict, options_obj); 1462 1462 if (!options) { 1463 - qobject_decref(options_obj); 1463 + qobject_unref(options_obj); 1464 1464 error_setg(errp, "Invalid JSON object given"); 1465 1465 return NULL; 1466 1466 } ··· 1490 1490 /* Options given in the filename have lower priority than options 1491 1491 * specified directly */ 1492 1492 qdict_join(options, json_options, false); 1493 - QDECREF(json_options); 1493 + qobject_unref(json_options); 1494 1494 *pfilename = NULL; 1495 1495 } 1496 1496 ··· 2273 2273 if (reference || qdict_haskey(options, "file.filename")) { 2274 2274 backing_filename[0] = '\0'; 2275 2275 } else if (bs->backing_file[0] == '\0' && qdict_size(options) == 0) { 2276 - QDECREF(options); 2276 + qobject_unref(options); 2277 2277 goto free_exit; 2278 2278 } else { 2279 2279 bdrv_get_full_backing_filename(bs, backing_filename, PATH_MAX, ··· 2281 2281 if (local_err) { 2282 2282 ret = -EINVAL; 2283 2283 error_propagate(errp, local_err); 2284 - QDECREF(options); 2284 + qobject_unref(options); 2285 2285 goto free_exit; 2286 2286 } 2287 2287 } ··· 2289 2289 if (!bs->drv || !bs->drv->supports_backing) { 2290 2290 ret = -EINVAL; 2291 2291 error_setg(errp, "Driver doesn't support backing files"); 2292 - QDECREF(options); 2292 + qobject_unref(options); 2293 2293 goto free_exit; 2294 2294 } 2295 2295 ··· 2323 2323 2324 2324 free_exit: 2325 2325 g_free(backing_filename); 2326 - QDECREF(tmp_parent_options); 2326 + qobject_unref(tmp_parent_options); 2327 2327 return ret; 2328 2328 } 2329 2329 ··· 2356 2356 error_setg(errp, "A block device must be specified for \"%s\"", 2357 2357 bdref_key); 2358 2358 } 2359 - QDECREF(image_options); 2359 + qobject_unref(image_options); 2360 2360 goto done; 2361 2361 } 2362 2362 ··· 2449 2449 obj = NULL; 2450 2450 2451 2451 fail: 2452 - qobject_decref(obj); 2452 + qobject_unref(obj); 2453 2453 visit_free(v); 2454 2454 return bs; 2455 2455 } ··· 2519 2519 } 2520 2520 2521 2521 out: 2522 - QDECREF(snapshot_options); 2522 + qobject_unref(snapshot_options); 2523 2523 g_free(tmp_filename); 2524 2524 return bs_snapshot; 2525 2525 } ··· 2530 2530 * options is a QDict of options to pass to the block drivers, or NULL for an 2531 2531 * empty set of options. The reference to the QDict belongs to the block layer 2532 2532 * after the call (even on failure), so if the caller intends to reuse the 2533 - * dictionary, it needs to use QINCREF() before calling bdrv_open. 2533 + * dictionary, it needs to use qobject_ref() before calling bdrv_open. 2534 2534 * 2535 2535 * If *pbs is NULL, a new BDS will be created with a pointer to it stored there. 2536 2536 * If it is not NULL, the referenced BDS will be reused. ··· 2561 2561 2562 2562 if (reference) { 2563 2563 bool options_non_empty = options ? qdict_size(options) : false; 2564 - QDECREF(options); 2564 + qobject_unref(options); 2565 2565 2566 2566 if (filename || options_non_empty) { 2567 2567 error_setg(errp, "Cannot reference an existing block device with " ··· 2752 2752 2753 2753 bdrv_parent_cb_change_media(bs, true); 2754 2754 2755 - QDECREF(options); 2755 + qobject_unref(options); 2756 2756 2757 2757 /* For snapshot=on, create a temporary qcow2 overlay. bs points to the 2758 2758 * temporary snapshot afterwards. */ ··· 2776 2776 2777 2777 fail: 2778 2778 blk_unref(file); 2779 - QDECREF(snapshot_options); 2780 - QDECREF(bs->explicit_options); 2781 - QDECREF(bs->options); 2782 - QDECREF(options); 2779 + qobject_unref(snapshot_options); 2780 + qobject_unref(bs->explicit_options); 2781 + qobject_unref(bs->options); 2782 + qobject_unref(options); 2783 2783 bs->options = NULL; 2784 2784 bs->explicit_options = NULL; 2785 2785 bdrv_unref(bs); ··· 2788 2788 2789 2789 close_and_fail: 2790 2790 bdrv_unref(bs); 2791 - QDECREF(snapshot_options); 2792 - QDECREF(options); 2791 + qobject_unref(snapshot_options); 2792 + qobject_unref(options); 2793 2793 error_propagate(errp, local_err); 2794 2794 return NULL; 2795 2795 } ··· 2884 2884 old_options = qdict_clone_shallow(bs->explicit_options); 2885 2885 } 2886 2886 bdrv_join_options(bs, options, old_options); 2887 - QDECREF(old_options); 2887 + qobject_unref(old_options); 2888 2888 2889 2889 explicit_options = qdict_clone_shallow(options); 2890 2890 ··· 2899 2899 qemu_opts_absorb_qdict(opts, options_copy, NULL); 2900 2900 update_flags_from_options(&flags, opts); 2901 2901 qemu_opts_del(opts); 2902 - QDECREF(options_copy); 2902 + qobject_unref(options_copy); 2903 2903 } 2904 2904 2905 2905 /* Old values are used for options that aren't set yet */ 2906 2906 old_options = qdict_clone_shallow(bs->options); 2907 2907 bdrv_join_options(bs, options, old_options); 2908 - QDECREF(old_options); 2908 + qobject_unref(old_options); 2909 2909 2910 2910 /* bdrv_open_inherit() sets and clears some additional flags internally */ 2911 2911 flags &= ~BDRV_O_PROTOCOL; ··· 2917 2917 bs_entry = g_new0(BlockReopenQueueEntry, 1); 2918 2918 QSIMPLEQ_INSERT_TAIL(bs_queue, bs_entry, entry); 2919 2919 } else { 2920 - QDECREF(bs_entry->state.options); 2921 - QDECREF(bs_entry->state.explicit_options); 2920 + qobject_unref(bs_entry->state.options); 2921 + qobject_unref(bs_entry->state.explicit_options); 2922 2922 } 2923 2923 2924 2924 bs_entry->state.bs = bs; ··· 3008 3008 if (ret && bs_entry->prepared) { 3009 3009 bdrv_reopen_abort(&bs_entry->state); 3010 3010 } else if (ret) { 3011 - QDECREF(bs_entry->state.explicit_options); 3011 + qobject_unref(bs_entry->state.explicit_options); 3012 3012 } 3013 - QDECREF(bs_entry->state.options); 3013 + qobject_unref(bs_entry->state.options); 3014 3014 g_free(bs_entry); 3015 3015 } 3016 3016 g_free(bs_queue); ··· 3253 3253 } 3254 3254 3255 3255 /* set BDS specific flags now */ 3256 - QDECREF(bs->explicit_options); 3256 + qobject_unref(bs->explicit_options); 3257 3257 3258 3258 bs->explicit_options = reopen_state->explicit_options; 3259 3259 bs->open_flags = reopen_state->flags; ··· 3296 3296 drv->bdrv_reopen_abort(reopen_state); 3297 3297 } 3298 3298 3299 - QDECREF(reopen_state->explicit_options); 3299 + qobject_unref(reopen_state->explicit_options); 3300 3300 3301 3301 bdrv_abort_perm_update(reopen_state->bs); 3302 3302 } ··· 3343 3343 bs->total_sectors = 0; 3344 3344 bs->encrypted = false; 3345 3345 bs->sg = false; 3346 - QDECREF(bs->options); 3347 - QDECREF(bs->explicit_options); 3346 + qobject_unref(bs->options); 3347 + qobject_unref(bs->explicit_options); 3348 3348 bs->options = NULL; 3349 3349 bs->explicit_options = NULL; 3350 - QDECREF(bs->full_open_options); 3350 + qobject_unref(bs->full_open_options); 3351 3351 bs->full_open_options = NULL; 3352 3352 3353 3353 bdrv_release_named_dirty_bitmaps(bs); ··· 5134 5134 continue; 5135 5135 } 5136 5136 5137 - qobject_incref(qdict_entry_value(entry)); 5137 + qobject_ref(qdict_entry_value(entry)); 5138 5138 qdict_put_obj(d, qdict_entry_key(entry), qdict_entry_value(entry)); 5139 5139 found_any = true; 5140 5140 } ··· 5174 5174 * information before refreshing it */ 5175 5175 bs->exact_filename[0] = '\0'; 5176 5176 if (bs->full_open_options) { 5177 - QDECREF(bs->full_open_options); 5177 + qobject_unref(bs->full_open_options); 5178 5178 bs->full_open_options = NULL; 5179 5179 } 5180 5180 5181 5181 opts = qdict_new(); 5182 5182 append_open_options(opts, bs); 5183 5183 drv->bdrv_refresh_filename(bs, opts); 5184 - QDECREF(opts); 5184 + qobject_unref(opts); 5185 5185 } else if (bs->file) { 5186 5186 /* Try to reconstruct valid information from the underlying file */ 5187 5187 bool has_open_options; 5188 5188 5189 5189 bs->exact_filename[0] = '\0'; 5190 5190 if (bs->full_open_options) { 5191 - QDECREF(bs->full_open_options); 5191 + qobject_unref(bs->full_open_options); 5192 5192 bs->full_open_options = NULL; 5193 5193 } 5194 5194 ··· 5207 5207 * suffices without querying the (exact_)filename of this BDS. */ 5208 5208 if (bs->file->bs->full_open_options) { 5209 5209 qdict_put_str(opts, "driver", drv->format_name); 5210 - QINCREF(bs->file->bs->full_open_options); 5210 + qobject_ref(bs->file->bs->full_open_options); 5211 5211 qdict_put(opts, "file", bs->file->bs->full_open_options); 5212 5212 5213 5213 bs->full_open_options = opts; 5214 5214 } else { 5215 - QDECREF(opts); 5215 + qobject_unref(opts); 5216 5216 } 5217 5217 } else if (!bs->full_open_options && qdict_size(bs->options)) { 5218 5218 /* There is no underlying file BDS (at least referenced by BDS.file), ··· 5246 5246 QString *json = qobject_to_json(QOBJECT(bs->full_open_options)); 5247 5247 snprintf(bs->filename, sizeof(bs->filename), "json:%s", 5248 5248 qstring_get_str(json)); 5249 - QDECREF(json); 5249 + qobject_unref(json); 5250 5250 } 5251 5251 } 5252 5252
+2 -2
block/blkdebug.c
··· 845 845 opts = qdict_new(); 846 846 qdict_put_str(opts, "driver", "blkdebug"); 847 847 848 - QINCREF(bs->file->bs->full_open_options); 848 + qobject_ref(bs->file->bs->full_open_options); 849 849 qdict_put(opts, "image", bs->file->bs->full_open_options); 850 850 851 851 for (e = qdict_first(options); e; e = qdict_next(options, e)) { 852 852 if (strcmp(qdict_entry_key(e), "x-image")) { 853 - qobject_incref(qdict_entry_value(e)); 853 + qobject_ref(qdict_entry_value(e)); 854 854 qdict_put_obj(opts, qdict_entry_key(e), qdict_entry_value(e)); 855 855 } 856 856 }
+2 -2
block/blkverify.c
··· 291 291 QDict *opts = qdict_new(); 292 292 qdict_put_str(opts, "driver", "blkverify"); 293 293 294 - QINCREF(bs->file->bs->full_open_options); 294 + qobject_ref(bs->file->bs->full_open_options); 295 295 qdict_put(opts, "raw", bs->file->bs->full_open_options); 296 - QINCREF(s->test_file->bs->full_open_options); 296 + qobject_ref(s->test_file->bs->full_open_options); 297 297 qdict_put(opts, "test", s->test_file->bs->full_open_options); 298 298 299 299 bs->full_open_options = opts;
+2 -2
block/crypto.c
··· 305 305 306 306 ret = 0; 307 307 cleanup: 308 - QDECREF(cryptoopts); 308 + qobject_unref(cryptoopts); 309 309 qapi_free_QCryptoBlockOpenOptions(open_opts); 310 310 return ret; 311 311 } ··· 635 635 fail: 636 636 bdrv_unref(bs); 637 637 qapi_free_QCryptoBlockCreateOptions(create_opts); 638 - QDECREF(cryptoopts); 638 + qobject_unref(cryptoopts); 639 639 return ret; 640 640 } 641 641
+2 -2
block/gluster.c
··· 650 650 } 651 651 gsconf = NULL; 652 652 653 - QDECREF(backing_options); 653 + qobject_unref(backing_options); 654 654 backing_options = NULL; 655 655 g_free(str); 656 656 str = NULL; ··· 663 663 qapi_free_SocketAddress(gsconf); 664 664 qemu_opts_del(opts); 665 665 g_free(str); 666 - QDECREF(backing_options); 666 + qobject_unref(backing_options); 667 667 errno = EINVAL; 668 668 return -errno; 669 669 }
+1 -1
block/iscsi.c
··· 2143 2143 } else { 2144 2144 ret = iscsi_open(bs, bs_options, 0, NULL); 2145 2145 } 2146 - QDECREF(bs_options); 2146 + qobject_unref(bs_options); 2147 2147 2148 2148 if (ret != 0) { 2149 2149 goto out;
+2 -2
block/nbd.c
··· 293 293 } 294 294 295 295 done: 296 - QDECREF(addr); 297 - qobject_decref(crumpled_addr); 296 + qobject_unref(addr); 297 + qobject_unref(crumpled_addr); 298 298 visit_free(iv); 299 299 return saddr; 300 300 }
+2 -2
block/nfs.c
··· 567 567 v = qobject_input_visitor_new_keyval(crumpled); 568 568 visit_type_BlockdevOptionsNfs(v, NULL, &opts, &local_err); 569 569 visit_free(v); 570 - qobject_decref(crumpled); 570 + qobject_unref(crumpled); 571 571 572 572 if (local_err) { 573 573 return NULL; ··· 683 683 684 684 ret = 0; 685 685 out: 686 - QDECREF(options); 686 + qobject_unref(options); 687 687 qapi_free_BlockdevCreateOptions(create_options); 688 688 return ret; 689 689 }
+1 -1
block/null.c
··· 244 244 245 245 static void null_refresh_filename(BlockDriverState *bs, QDict *opts) 246 246 { 247 - QINCREF(opts); 247 + qobject_ref(opts); 248 248 qdict_del(opts, "filename"); 249 249 250 250 if (!qdict_size(opts)) {
+1 -1
block/nvme.c
··· 1073 1073 1074 1074 static void nvme_refresh_filename(BlockDriverState *bs, QDict *opts) 1075 1075 { 1076 - QINCREF(opts); 1076 + qobject_ref(opts); 1077 1077 qdict_del(opts, "filename"); 1078 1078 1079 1079 if (!qdict_size(opts)) {
+2 -2
block/parallels.c
··· 651 651 qdict_put_str(qdict, "file", bs->node_name); 652 652 653 653 qobj = qdict_crumple(qdict, errp); 654 - QDECREF(qdict); 654 + qobject_unref(qdict); 655 655 qdict = qobject_to(QDict, qobj); 656 656 if (qdict == NULL) { 657 657 ret = -EINVAL; ··· 682 682 ret = 0; 683 683 684 684 done: 685 - QDECREF(qdict); 685 + qobject_unref(qdict); 686 686 bdrv_unref(bs); 687 687 qapi_free_BlockdevCreateOptions(create_options); 688 688 return ret;
+1 -1
block/qapi.c
··· 773 773 visit_complete(v, &obj); 774 774 data = qdict_get(qobject_to(QDict, obj), "data"); 775 775 dump_qobject(func_fprintf, f, 1, data); 776 - qobject_decref(obj); 776 + qobject_unref(obj); 777 777 visit_free(v); 778 778 } 779 779
+4 -4
block/qcow.c
··· 315 315 goto fail; 316 316 } 317 317 318 - QDECREF(encryptopts); 318 + qobject_unref(encryptopts); 319 319 qapi_free_QCryptoBlockOpenOptions(crypto_opts); 320 320 qemu_co_mutex_init(&s->lock); 321 321 return 0; ··· 326 326 g_free(s->cluster_cache); 327 327 g_free(s->cluster_data); 328 328 qcrypto_block_free(s->crypto); 329 - QDECREF(encryptopts); 329 + qobject_unref(encryptopts); 330 330 qapi_free_QCryptoBlockOpenOptions(crypto_opts); 331 331 return ret; 332 332 } ··· 995 995 qdict_put_str(qdict, "file", bs->node_name); 996 996 997 997 qobj = qdict_crumple(qdict, errp); 998 - QDECREF(qdict); 998 + qobject_unref(qdict); 999 999 qdict = qobject_to(QDict, qobj); 1000 1000 if (qdict == NULL) { 1001 1001 ret = -EINVAL; ··· 1025 1025 1026 1026 ret = 0; 1027 1027 fail: 1028 - QDECREF(qdict); 1028 + qobject_unref(qdict); 1029 1029 bdrv_unref(bs); 1030 1030 qapi_free_BlockdevCreateOptions(create_options); 1031 1031 return ret;
+4 -4
block/qcow2.c
··· 1063 1063 1064 1064 ret = 0; 1065 1065 fail: 1066 - QDECREF(encryptopts); 1066 + qobject_unref(encryptopts); 1067 1067 qemu_opts_del(opts); 1068 1068 opts = NULL; 1069 1069 return ret; ··· 2183 2183 qemu_co_mutex_lock(&s->lock); 2184 2184 ret = qcow2_do_open(bs, options, flags, &local_err); 2185 2185 qemu_co_mutex_unlock(&s->lock); 2186 - QDECREF(options); 2186 + qobject_unref(options); 2187 2187 if (local_err) { 2188 2188 error_propagate(errp, local_err); 2189 2189 error_prepend(errp, "Could not reopen qcow2 layer: "); ··· 3139 3139 3140 3140 /* Now get the QAPI type BlockdevCreateOptions */ 3141 3141 qobj = qdict_crumple(qdict, errp); 3142 - QDECREF(qdict); 3142 + qobject_unref(qdict); 3143 3143 qdict = qobject_to(QDict, qobj); 3144 3144 if (qdict == NULL) { 3145 3145 ret = -EINVAL; ··· 3168 3168 3169 3169 ret = 0; 3170 3170 finish: 3171 - QDECREF(qdict); 3171 + qobject_unref(qdict); 3172 3172 bdrv_unref(bs); 3173 3173 qapi_free_BlockdevCreateOptions(create_options); 3174 3174 return ret;
+2 -2
block/qed.c
··· 763 763 qdict_put_str(qdict, "file", bs->node_name); 764 764 765 765 qobj = qdict_crumple(qdict, errp); 766 - QDECREF(qdict); 766 + qobject_unref(qdict); 767 767 qdict = qobject_to(QDict, qobj); 768 768 if (qdict == NULL) { 769 769 ret = -EINVAL; ··· 789 789 ret = bdrv_qed_co_create(create_options, errp); 790 790 791 791 fail: 792 - QDECREF(qdict); 792 + qobject_unref(qdict); 793 793 bdrv_unref(bs); 794 794 qapi_free_BlockdevCreateOptions(create_options); 795 795 return ret;
+1 -1
block/quorum.c
··· 1082 1082 1083 1083 children = qlist_new(); 1084 1084 for (i = 0; i < s->num_children; i++) { 1085 - QINCREF(s->children[i]->bs->full_open_options); 1085 + qobject_ref(s->children[i]->bs->full_open_options); 1086 1086 qlist_append(children, s->children[i]->bs->full_open_options); 1087 1087 } 1088 1088
+7 -7
block/rbd.c
··· 226 226 227 227 done: 228 228 g_free(buf); 229 - QDECREF(keypairs); 229 + qobject_unref(keypairs); 230 230 return; 231 231 } 232 232 ··· 275 275 key = qstring_get_str(name); 276 276 277 277 ret = rados_conf_set(cluster, key, qstring_get_str(value)); 278 - QDECREF(value); 278 + qobject_unref(value); 279 279 if (ret < 0) { 280 280 error_setg_errno(errp, -ret, "invalid conf option %s", key); 281 - QDECREF(name); 281 + qobject_unref(name); 282 282 ret = -EINVAL; 283 283 break; 284 284 } 285 - QDECREF(name); 285 + qobject_unref(name); 286 286 } 287 287 288 - QDECREF(keypairs); 288 + qobject_unref(keypairs); 289 289 return ret; 290 290 } 291 291 ··· 449 449 } 450 450 451 451 exit: 452 - QDECREF(options); 452 + qobject_unref(options); 453 453 qapi_free_BlockdevCreateOptions(create_options); 454 454 return ret; 455 455 } ··· 664 664 v = qobject_input_visitor_new_keyval(crumpled); 665 665 visit_type_BlockdevOptionsRbd(v, NULL, &opts, &local_err); 666 666 visit_free(v); 667 - qobject_decref(crumpled); 667 + qobject_unref(crumpled); 668 668 669 669 if (local_err) { 670 670 error_propagate(errp, local_err);
+6 -6
block/sheepdog.c
··· 567 567 568 568 done: 569 569 visit_free(iv); 570 - qobject_decref(crumpled_server); 571 - QDECREF(server); 570 + qobject_unref(crumpled_server); 571 + qobject_unref(server); 572 572 return saddr; 573 573 } 574 574 ··· 1883 1883 1884 1884 if (local_err) { 1885 1885 error_propagate(errp, local_err); 1886 - qobject_decref(obj); 1886 + qobject_unref(obj); 1887 1887 return -EINVAL; 1888 1888 } 1889 1889 ··· 1901 1901 ret = sd_prealloc(bs, 0, size, errp); 1902 1902 fail: 1903 1903 bdrv_unref(bs); 1904 - QDECREF(qdict); 1904 + qobject_unref(qdict); 1905 1905 return ret; 1906 1906 } 1907 1907 ··· 2226 2226 v = qobject_input_visitor_new_keyval(crumpled); 2227 2227 visit_type_BlockdevCreateOptions(v, NULL, &create_options, &local_err); 2228 2228 visit_free(v); 2229 - qobject_decref(crumpled); 2229 + qobject_unref(crumpled); 2230 2230 2231 2231 if (local_err) { 2232 2232 error_propagate(errp, local_err); ··· 2252 2252 ret = sd_co_create(create_options, errp); 2253 2253 fail: 2254 2254 qapi_free_BlockdevCreateOptions(create_options); 2255 - QDECREF(qdict); 2255 + qobject_unref(qdict); 2256 2256 return ret; 2257 2257 } 2258 2258
+2 -2
block/snapshot.c
··· 214 214 bdrv_ref(file); 215 215 216 216 qdict_extract_subqdict(options, &file_options, "file."); 217 - QDECREF(file_options); 217 + qobject_unref(file_options); 218 218 qdict_put_str(options, "file", bdrv_get_node_name(file)); 219 219 220 220 drv->bdrv_close(bs); ··· 223 223 224 224 ret = bdrv_snapshot_goto(file, snapshot_id, errp); 225 225 open_ret = drv->bdrv_open(bs, options, bs->open_flags, &local_err); 226 - QDECREF(options); 226 + qobject_unref(options); 227 227 if (open_ret < 0) { 228 228 bdrv_unref(file); 229 229 bs->drv = NULL;
+2 -2
block/ssh.c
··· 638 638 v = qobject_input_visitor_new(crumpled); 639 639 visit_type_BlockdevOptionsSsh(v, NULL, &result, &local_err); 640 640 visit_free(v); 641 - qobject_decref(crumpled); 641 + qobject_unref(crumpled); 642 642 643 643 if (local_err) { 644 644 error_propagate(errp, local_err); ··· 917 917 ret = ssh_co_create(create_options, errp); 918 918 919 919 out: 920 - QDECREF(uri_options); 920 + qobject_unref(uri_options); 921 921 qapi_free_BlockdevCreateOptions(create_options); 922 922 return ret; 923 923 }
+1 -1
block/vdi.c
··· 951 951 /* Create the vdi image (format layer) */ 952 952 ret = vdi_co_do_create(create_options, block_size, errp); 953 953 done: 954 - QDECREF(qdict); 954 + qobject_unref(qdict); 955 955 qapi_free_BlockdevCreateOptions(create_options); 956 956 bdrv_unref(bs_file); 957 957 return ret;
+2 -2
block/vhdx.c
··· 2003 2003 qdict_put_str(qdict, "file", bs->node_name); 2004 2004 2005 2005 qobj = qdict_crumple(qdict, errp); 2006 - QDECREF(qdict); 2006 + qobject_unref(qdict); 2007 2007 qdict = qobject_to(QDict, qobj); 2008 2008 if (qdict == NULL) { 2009 2009 ret = -EINVAL; ··· 2049 2049 ret = vhdx_co_create(create_options, errp); 2050 2050 2051 2051 fail: 2052 - QDECREF(qdict); 2052 + qobject_unref(qdict); 2053 2053 bdrv_unref(bs); 2054 2054 qapi_free_BlockdevCreateOptions(create_options); 2055 2055 return ret;
+2 -2
block/vpc.c
··· 1119 1119 qdict_put_str(qdict, "file", bs->node_name); 1120 1120 1121 1121 qobj = qdict_crumple(qdict, errp); 1122 - QDECREF(qdict); 1122 + qobject_unref(qdict); 1123 1123 qdict = qobject_to(QDict, qobj); 1124 1124 if (qdict == NULL) { 1125 1125 ret = -EINVAL; ··· 1157 1157 ret = vpc_co_create(create_options, errp); 1158 1158 1159 1159 fail: 1160 - QDECREF(qdict); 1160 + qobject_unref(qdict); 1161 1161 bdrv_unref(bs); 1162 1162 qapi_free_BlockdevCreateOptions(create_options); 1163 1163 return ret;
+1 -1
block/vvfat.c
··· 3179 3179 qdict_put_str(options, "write-target.driver", "qcow"); 3180 3180 s->qcow = bdrv_open_child(s->qcow_filename, options, "write-target", bs, 3181 3181 &child_vvfat_qcow, false, errp); 3182 - QDECREF(options); 3182 + qobject_unref(options); 3183 3183 if (!s->qcow) { 3184 3184 ret = -EINVAL; 3185 3185 goto err;
+1 -1
block/vxhs.c
··· 396 396 397 397 out: 398 398 g_free(of_vsa_addr); 399 - QDECREF(backing_options); 399 + qobject_unref(backing_options); 400 400 qemu_opts_del(tcp_opts); 401 401 qemu_opts_del(opts); 402 402 g_free(cacert);
+8 -8
blockdev.c
··· 576 576 blk_rs->read_only = read_only; 577 577 blk_rs->detect_zeroes = detect_zeroes; 578 578 579 - QDECREF(bs_opts); 579 + qobject_unref(bs_opts); 580 580 } else { 581 581 if (file && !*file) { 582 582 file = NULL; ··· 632 632 633 633 err_no_bs_opts: 634 634 qemu_opts_del(opts); 635 - QDECREF(interval_dict); 636 - QDECREF(interval_list); 635 + qobject_unref(interval_dict); 636 + qobject_unref(interval_list); 637 637 return blk; 638 638 639 639 early_err: 640 640 qemu_opts_del(opts); 641 - QDECREF(interval_dict); 642 - QDECREF(interval_list); 641 + qobject_unref(interval_dict); 642 + qobject_unref(interval_list); 643 643 err_no_opts: 644 - QDECREF(bs_opts); 644 + qobject_unref(bs_opts); 645 645 return NULL; 646 646 } 647 647 ··· 1130 1130 1131 1131 fail: 1132 1132 qemu_opts_del(legacy_opts); 1133 - QDECREF(bs_opts); 1133 + qobject_unref(bs_opts); 1134 1134 return dinfo; 1135 1135 } 1136 1136 ··· 4022 4022 qdict = qemu_opts_to_qdict(opts, NULL); 4023 4023 4024 4024 if (!qdict_get_try_str(qdict, "node-name")) { 4025 - QDECREF(qdict); 4025 + qobject_unref(qdict); 4026 4026 error_report("'node-name' needs to be specified"); 4027 4027 goto out; 4028 4028 }
+1 -1
docs/devel/qapi-code-gen.txt
··· 1340 1340 emit(EXAMPLE_QAPI_EVENT_MY_EVENT, qmp, &err); 1341 1341 1342 1342 error_propagate(errp, err); 1343 - QDECREF(qmp); 1343 + qobject_unref(qmp); 1344 1344 } 1345 1345 1346 1346 const QEnumLookup example_QAPIEvent_lookup = {
+6 -6
hw/i386/acpi-build.c
··· 198 198 } else { 199 199 pm->s3_disabled = false; 200 200 } 201 - qobject_decref(o); 201 + qobject_unref(o); 202 202 o = object_property_get_qobject(obj, ACPI_PM_PROP_S4_DISABLED, NULL); 203 203 if (o) { 204 204 pm->s4_disabled = qnum_get_uint(qobject_to(QNum, o)); 205 205 } else { 206 206 pm->s4_disabled = false; 207 207 } 208 - qobject_decref(o); 208 + qobject_unref(o); 209 209 o = object_property_get_qobject(obj, ACPI_PM_PROP_S4_VAL, NULL); 210 210 if (o) { 211 211 pm->s4_val = qnum_get_uint(qobject_to(QNum, o)); 212 212 } else { 213 213 pm->s4_val = false; 214 214 } 215 - qobject_decref(o); 215 + qobject_unref(o); 216 216 217 217 pm->pcihp_bridge_en = 218 218 object_property_get_bool(obj, "acpi-pci-hotplug-with-bridge-support", ··· 570 570 } 571 571 } 572 572 aml_append(parent_scope, method); 573 - qobject_decref(bsel); 573 + qobject_unref(bsel); 574 574 } 575 575 576 576 /** ··· 2614 2614 return false; 2615 2615 } 2616 2616 mcfg->mcfg_base = qnum_get_uint(qobject_to(QNum, o)); 2617 - qobject_decref(o); 2617 + qobject_unref(o); 2618 2618 2619 2619 o = object_property_get_qobject(pci_host, PCIE_HOST_MCFG_SIZE, NULL); 2620 2620 assert(o); 2621 2621 mcfg->mcfg_size = qnum_get_uint(qobject_to(QNum, o)); 2622 - qobject_decref(o); 2622 + qobject_unref(o); 2623 2623 return true; 2624 2624 } 2625 2625
+1 -1
hw/ppc/spapr_drc.c
··· 305 305 306 306 if (!drc->fdt) { 307 307 visit_type_null(v, NULL, &null, errp); 308 - QDECREF(null); 308 + qobject_unref(null); 309 309 return; 310 310 } 311 311
+2 -2
hw/usb/xen-usb.c
··· 763 763 if (!usbif->ports[port - 1].dev) { 764 764 goto err; 765 765 } 766 - QDECREF(qdict); 766 + qobject_unref(qdict); 767 767 speed = usbif->ports[port - 1].dev->speed; 768 768 switch (speed) { 769 769 case USB_SPEED_LOW: ··· 796 796 return; 797 797 798 798 err: 799 - QDECREF(qdict); 799 + qobject_unref(qdict); 800 800 xen_pv_printf(&usbif->xendev, 0, "device %s could not be opened\n", busid); 801 801 } 802 802
+1 -1
include/qapi/qmp/qnull.h
··· 23 23 24 24 static inline QNull *qnull(void) 25 25 { 26 - QINCREF(&qnull_); 26 + qobject_ref(&qnull_); 27 27 return &qnull_; 28 28 } 29 29
+18 -22
include/qapi/qmp/qobject.h
··· 15 15 * ------------------------------------ 16 16 * 17 17 * - Returning references: A function that returns an object may 18 - * return it as either a weak or a strong reference. If the reference 19 - * is strong, you are responsible for calling QDECREF() on the reference 20 - * when you are done. 18 + * return it as either a weak or a strong reference. If the 19 + * reference is strong, you are responsible for calling 20 + * qobject_unref() on the reference when you are done. 21 21 * 22 22 * If the reference is weak, the owner of the reference may free it at 23 23 * any time in the future. Before storing the reference anywhere, you 24 - * should call QINCREF() to make the reference strong. 24 + * should call qobject_ref() to make the reference strong. 25 25 * 26 26 * - Transferring ownership: when you transfer ownership of a reference 27 27 * by calling a function, you are no longer responsible for calling 28 - * QDECREF() when the reference is no longer needed. In other words, 28 + * qobject_unref() when the reference is no longer needed. In other words, 29 29 * when the function returns you must behave as if the reference to the 30 30 * passed object was weak. 31 31 */ ··· 50 50 _obj ? container_of(&(_obj)->base, QObject, base) : NULL; \ 51 51 }) 52 52 53 - /* High-level interface for qobject_incref() */ 54 - #define QINCREF(obj) \ 55 - qobject_incref(QOBJECT(obj)) 56 - 57 - /* High-level interface for qobject_decref() */ 58 - #define QDECREF(obj) \ 59 - qobject_decref(obj ? QOBJECT(obj) : NULL) 60 - 61 53 /* Required for qobject_to() */ 62 54 #define QTYPE_CAST_TO_QNull QTYPE_QNULL 63 55 #define QTYPE_CAST_TO_QNum QTYPE_QNUM ··· 80 72 obj->base.type = type; 81 73 } 82 74 83 - /** 84 - * qobject_incref(): Increment QObject's reference count 85 - */ 86 - static inline void qobject_incref(QObject *obj) 75 + static inline void qobject_ref_impl(QObject *obj) 87 76 { 88 77 if (obj) { 89 78 obj->base.refcnt++; ··· 104 93 */ 105 94 void qobject_destroy(QObject *obj); 106 95 107 - /** 108 - * qobject_decref(): Decrement QObject's reference count, deallocate 109 - * when it reaches zero 110 - */ 111 - static inline void qobject_decref(QObject *obj) 96 + static inline void qobject_unref_impl(QObject *obj) 112 97 { 113 98 assert(!obj || obj->base.refcnt); 114 99 if (obj && --obj->base.refcnt == 0) { 115 100 qobject_destroy(obj); 116 101 } 117 102 } 103 + 104 + /** 105 + * qobject_ref(): Increment QObject's reference count 106 + */ 107 + #define qobject_ref(obj) qobject_ref_impl(QOBJECT(obj)) 108 + 109 + /** 110 + * qobject_unref(): Decrement QObject's reference count, deallocate 111 + * when it reaches zero 112 + */ 113 + #define qobject_unref(obj) qobject_unref_impl(QOBJECT(obj)) 118 114 119 115 /** 120 116 * qobject_type(): Return the QObject's type
+2 -2
migration/migration.c
··· 1040 1040 /* TODO Rewrite "" to null instead */ 1041 1041 if (params->has_tls_creds 1042 1042 && params->tls_creds->type == QTYPE_QNULL) { 1043 - QDECREF(params->tls_creds->u.n); 1043 + qobject_unref(params->tls_creds->u.n); 1044 1044 params->tls_creds->type = QTYPE_QSTRING; 1045 1045 params->tls_creds->u.s = strdup(""); 1046 1046 } 1047 1047 /* TODO Rewrite "" to null instead */ 1048 1048 if (params->has_tls_hostname 1049 1049 && params->tls_hostname->type == QTYPE_QNULL) { 1050 - QDECREF(params->tls_hostname->u.n); 1050 + qobject_unref(params->tls_hostname->u.n); 1051 1051 params->tls_hostname->type = QTYPE_QSTRING; 1052 1052 params->tls_hostname->u.s = strdup(""); 1053 1053 }
+1 -1
migration/qjson.c
··· 109 109 110 110 void qjson_destroy(QJSON *json) 111 111 { 112 - QDECREF(json->str); 112 + qobject_unref(json->str); 113 113 g_free(json); 114 114 }
+25 -25
monitor.c
··· 329 329 330 330 static void qmp_request_free(QMPRequest *req) 331 331 { 332 - qobject_decref(req->id); 333 - qobject_decref(req->req); 332 + qobject_unref(req->id); 333 + qobject_unref(req->req); 334 334 g_free(req); 335 335 } 336 336 ··· 346 346 static void monitor_qmp_cleanup_resp_queue_locked(Monitor *mon) 347 347 { 348 348 while (!g_queue_is_empty(mon->qmp.qmp_responses)) { 349 - qobject_decref(g_queue_pop_head(mon->qmp.qmp_responses)); 349 + qobject_unref((QObject *)g_queue_pop_head(mon->qmp.qmp_responses)); 350 350 } 351 351 } 352 352 ··· 391 391 rc = qemu_chr_fe_write(&mon->chr, (const uint8_t *) buf, len); 392 392 if ((rc < 0 && errno != EAGAIN) || (rc == len)) { 393 393 /* all flushed or error */ 394 - QDECREF(mon->outbuf); 394 + qobject_unref(mon->outbuf); 395 395 mon->outbuf = qstring_new(); 396 396 return; 397 397 } 398 398 if (rc > 0) { 399 399 /* partial write */ 400 400 QString *tmp = qstring_from_str(buf + rc); 401 - QDECREF(mon->outbuf); 401 + qobject_unref(mon->outbuf); 402 402 mon->outbuf = tmp; 403 403 } 404 404 if (mon->out_watch == 0) { ··· 482 482 qstring_append_chr(json, '\n'); 483 483 monitor_puts(mon, qstring_get_str(json)); 484 484 485 - QDECREF(json); 485 + qobject_unref(json); 486 486 } 487 487 488 488 static void monitor_json_emitter(Monitor *mon, QObject *data) ··· 494 494 * caller won't free the data (which will be finally freed in 495 495 * responder thread). 496 496 */ 497 - qobject_incref(data); 497 + qobject_ref(data); 498 498 qemu_mutex_lock(&mon->qmp.qmp_queue_lock); 499 - g_queue_push_tail(mon->qmp.qmp_responses, (void *)data); 499 + g_queue_push_tail(mon->qmp.qmp_responses, data); 500 500 qemu_mutex_unlock(&mon->qmp.qmp_queue_lock); 501 501 qemu_bh_schedule(mon_global.qmp_respond_bh); 502 502 } else { ··· 546 546 break; 547 547 } 548 548 monitor_json_emitter_raw(response.mon, response.data); 549 - qobject_decref(response.data); 549 + qobject_unref(response.data); 550 550 } 551 551 } 552 552 ··· 613 613 * last send. Store event for sending when timer fires, 614 614 * replacing a prior stored event if any. 615 615 */ 616 - QDECREF(evstate->qdict); 616 + qobject_unref(evstate->qdict); 617 617 evstate->qdict = qdict; 618 - QINCREF(evstate->qdict); 618 + qobject_ref(evstate->qdict); 619 619 } else { 620 620 /* 621 621 * Last send was (at least) evconf->rate ns ago. ··· 630 630 evstate = g_new(MonitorQAPIEventState, 1); 631 631 evstate->event = event; 632 632 evstate->data = data; 633 - QINCREF(evstate->data); 633 + qobject_ref(evstate->data); 634 634 evstate->qdict = NULL; 635 635 evstate->timer = timer_new_ns(event_clock_type, 636 636 monitor_qapi_event_handler, ··· 660 660 int64_t now = qemu_clock_get_ns(event_clock_type); 661 661 662 662 monitor_qapi_event_emit(evstate->event, evstate->qdict); 663 - QDECREF(evstate->qdict); 663 + qobject_unref(evstate->qdict); 664 664 evstate->qdict = NULL; 665 665 timer_mod_ns(evstate->timer, now + evconf->rate); 666 666 } else { 667 667 g_hash_table_remove(monitor_qapi_event_state, evstate); 668 - QDECREF(evstate->data); 668 + qobject_unref(evstate->data); 669 669 timer_free(evstate->timer); 670 670 g_free(evstate); 671 671 } ··· 747 747 json_message_parser_destroy(&mon->qmp.parser); 748 748 } 749 749 readline_free(mon->rs); 750 - QDECREF(mon->outbuf); 750 + qobject_unref(mon->outbuf); 751 751 qemu_mutex_destroy(&mon->out_lock); 752 752 qemu_mutex_destroy(&mon->qmp.qmp_queue_lock); 753 753 monitor_qmp_cleanup_req_queue_locked(mon); ··· 3362 3362 return qdict; 3363 3363 3364 3364 fail: 3365 - QDECREF(qdict); 3365 + qobject_unref(qdict); 3366 3366 g_free(key); 3367 3367 return NULL; 3368 3368 } ··· 3387 3387 } 3388 3388 3389 3389 cmd->cmd(mon, qdict); 3390 - QDECREF(qdict); 3390 + qobject_unref(qdict); 3391 3391 } 3392 3392 3393 3393 static void cmd_completion(Monitor *mon, const char *name, const char *list) ··· 4049 4049 if (rsp) { 4050 4050 if (id) { 4051 4051 /* This is for the qdict below. */ 4052 - qobject_incref(id); 4052 + qobject_ref(id); 4053 4053 qdict_put_obj(qobject_to(QDict, rsp), "id", id); 4054 4054 } 4055 4055 4056 4056 monitor_json_emitter(mon, rsp); 4057 4057 } 4058 4058 4059 - qobject_decref(id); 4060 - qobject_decref(rsp); 4059 + qobject_unref(id); 4060 + qobject_unref(rsp); 4061 4061 } 4062 4062 4063 4063 /* ··· 4080 4080 if (trace_event_get_state_backends(TRACE_HANDLE_QMP_COMMAND)) { 4081 4081 QString *req_json = qobject_to_json(req); 4082 4082 trace_handle_qmp_command(mon, qstring_get_str(req_json)); 4083 - QDECREF(req_json); 4083 + qobject_unref(req_json); 4084 4084 } 4085 4085 4086 4086 old_mon = cur_mon; ··· 4098 4098 monitor_resume(mon); 4099 4099 } 4100 4100 4101 - qobject_decref(req); 4101 + qobject_unref(req); 4102 4102 } 4103 4103 4104 4104 /* ··· 4190 4190 goto err; 4191 4191 } 4192 4192 4193 - qobject_incref(id); 4193 + qobject_ref(id); 4194 4194 qdict_del(qdict, "id"); 4195 4195 4196 4196 req_obj = g_new0(QMPRequest, 1); ··· 4245 4245 4246 4246 err: 4247 4247 monitor_qmp_respond(mon, NULL, err, NULL); 4248 - qobject_decref(req); 4248 + qobject_unref(req); 4249 4249 } 4250 4250 4251 4251 static void monitor_qmp_read(void *opaque, const uint8_t *buf, int size) ··· 4364 4364 monitor_qmp_caps_reset(mon); 4365 4365 data = get_qmp_greeting(mon); 4366 4366 monitor_json_emitter(mon, data); 4367 - qobject_decref(data); 4367 + qobject_unref(data); 4368 4368 mon_refcount++; 4369 4369 break; 4370 4370 case CHR_EVENT_CLOSED:
+2 -2
qapi/qapi-dealloc-visitor.c
··· 99 99 QObject **obj, Error **errp) 100 100 { 101 101 if (obj) { 102 - qobject_decref(*obj); 102 + qobject_unref(*obj); 103 103 } 104 104 } 105 105 ··· 107 107 QNull **obj, Error **errp) 108 108 { 109 109 if (obj) { 110 - QDECREF(*obj); 110 + qobject_unref(*obj); 111 111 } 112 112 } 113 113
+3 -3
qapi/qmp-dispatch.c
··· 105 105 args = qdict_new(); 106 106 } else { 107 107 args = qdict_get_qdict(dict, "arguments"); 108 - QINCREF(args); 108 + qobject_ref(args); 109 109 } 110 110 111 111 cmd->fn(args, &ret, &local_err); ··· 117 117 ret = QOBJECT(qdict_new()); 118 118 } 119 119 120 - QDECREF(args); 120 + qobject_unref(args); 121 121 122 122 return ret; 123 123 } ··· 166 166 } else if (ret) { 167 167 qdict_put_obj(rsp, "return", ret); 168 168 } else { 169 - QDECREF(rsp); 169 + qobject_unref(rsp); 170 170 return NULL; 171 171 } 172 172
+4 -4
qapi/qobject-input-visitor.c
··· 588 588 return; 589 589 } 590 590 591 - qobject_incref(qobj); 591 + qobject_ref(qobj); 592 592 *obj = qobj; 593 593 } 594 594 ··· 652 652 qobject_input_stack_object_free(tos); 653 653 } 654 654 655 - qobject_decref(qiv->root); 655 + qobject_unref(qiv->root); 656 656 if (qiv->errname) { 657 657 g_string_free(qiv->errname, TRUE); 658 658 } ··· 678 678 v->visitor.free = qobject_input_free; 679 679 680 680 v->root = obj; 681 - qobject_incref(obj); 681 + qobject_ref(obj); 682 682 683 683 return v; 684 684 } ··· 744 744 } 745 745 v = qobject_input_visitor_new_keyval(QOBJECT(args)); 746 746 } 747 - QDECREF(args); 747 + qobject_unref(args); 748 748 749 749 return v; 750 750 }
+4 -4
qapi/qobject-output-visitor.c
··· 188 188 QObject **obj, Error **errp) 189 189 { 190 190 QObjectOutputVisitor *qov = to_qov(v); 191 - qobject_incref(*obj); 191 + qobject_ref(*obj); 192 192 qobject_output_add_obj(qov, name, *obj); 193 193 } 194 194 ··· 201 201 202 202 /* Finish building, and return the root object. 203 203 * The root object is never null. The caller becomes the object's 204 - * owner, and should use qobject_decref() when done with it. */ 204 + * owner, and should use qobject_unref() when done with it. */ 205 205 static void qobject_output_complete(Visitor *v, void *opaque) 206 206 { 207 207 QObjectOutputVisitor *qov = to_qov(v); ··· 210 210 assert(qov->root && QSLIST_EMPTY(&qov->stack)); 211 211 assert(opaque == qov->result); 212 212 213 - qobject_incref(qov->root); 213 + qobject_ref(qov->root); 214 214 *qov->result = qov->root; 215 215 qov->result = NULL; 216 216 } ··· 226 226 g_free(e); 227 227 } 228 228 229 - qobject_decref(qov->root); 229 + qobject_unref(qov->root); 230 230 g_free(qov); 231 231 } 232 232
+9 -9
qemu-img.c
··· 279 279 if (qdict_haskey(options, BDRV_OPT_FORCE_SHARE) 280 280 && !qdict_get_bool(options, BDRV_OPT_FORCE_SHARE)) { 281 281 error_report("--force-share/-U conflicts with image options"); 282 - QDECREF(options); 282 + qobject_unref(options); 283 283 return NULL; 284 284 } 285 285 qdict_put_bool(options, BDRV_OPT_FORCE_SHARE, true); ··· 561 561 str = qobject_to_json_pretty(obj); 562 562 assert(str != NULL); 563 563 qprintf(quiet, "%s\n", qstring_get_str(str)); 564 - qobject_decref(obj); 564 + qobject_unref(obj); 565 565 visit_free(v); 566 - QDECREF(str); 566 + qobject_unref(str); 567 567 } 568 568 569 569 static void dump_human_image_check(ImageCheck *check, bool quiet) ··· 2384 2384 str = qobject_to_json_pretty(obj); 2385 2385 assert(str != NULL); 2386 2386 printf("%s\n", qstring_get_str(str)); 2387 - qobject_decref(obj); 2387 + qobject_unref(obj); 2388 2388 visit_free(v); 2389 - QDECREF(str); 2389 + qobject_unref(str); 2390 2390 } 2391 2391 2392 2392 static void dump_json_image_info(ImageInfo *info) ··· 2400 2400 str = qobject_to_json_pretty(obj); 2401 2401 assert(str != NULL); 2402 2402 printf("%s\n", qstring_get_str(str)); 2403 - qobject_decref(obj); 2403 + qobject_unref(obj); 2404 2404 visit_free(v); 2405 - QDECREF(str); 2405 + qobject_unref(str); 2406 2406 } 2407 2407 2408 2408 static void dump_human_image_info_list(ImageInfoList *list) ··· 4457 4457 str = qobject_to_json_pretty(obj); 4458 4458 assert(str != NULL); 4459 4459 printf("%s\n", qstring_get_str(str)); 4460 - qobject_decref(obj); 4460 + qobject_unref(obj); 4461 4461 visit_free(v); 4462 - QDECREF(str); 4462 + qobject_unref(str); 4463 4463 } 4464 4464 4465 4465 static int img_measure(int argc, char **argv)
+3 -3
qemu-io.c
··· 86 86 87 87 if (qemuio_blk) { 88 88 error_report("file open already, try 'help close'"); 89 - QDECREF(opts); 89 + qobject_unref(opts); 90 90 return 1; 91 91 } 92 92 ··· 97 97 if (qdict_haskey(opts, BDRV_OPT_FORCE_SHARE) 98 98 && !qdict_get_bool(opts, BDRV_OPT_FORCE_SHARE)) { 99 99 error_report("-U conflicts with image options"); 100 - QDECREF(opts); 100 + qobject_unref(opts); 101 101 return 1; 102 102 } 103 103 qdict_put_bool(opts, BDRV_OPT_FORCE_SHARE, true); ··· 243 243 } else if (optind == argc) { 244 244 openfile(NULL, flags, writethrough, force_share, opts); 245 245 } else { 246 - QDECREF(opts); 246 + qobject_unref(opts); 247 247 qemuio_command_usage(&open_cmd); 248 248 } 249 249 return 0;
+6 -6
qga/main.c
··· 563 563 response_qstr = qstring_new(); 564 564 qstring_append_chr(response_qstr, QGA_SENTINEL_BYTE); 565 565 qstring_append(response_qstr, qstring_get_str(payload_qstr)); 566 - QDECREF(payload_qstr); 566 + qobject_unref(payload_qstr); 567 567 } else { 568 568 response_qstr = payload_qstr; 569 569 } ··· 571 571 qstring_append_chr(response_qstr, '\n'); 572 572 buf = qstring_get_str(response_qstr); 573 573 status = ga_channel_write_all(s->channel, buf, strlen(buf)); 574 - QDECREF(response_qstr); 574 + qobject_unref(response_qstr); 575 575 if (status != G_IO_STATUS_NORMAL) { 576 576 return -EIO; 577 577 } ··· 592 592 if (ret < 0) { 593 593 g_warning("error sending response: %s", strerror(-ret)); 594 594 } 595 - qobject_decref(rsp); 595 + qobject_unref(rsp); 596 596 } 597 597 } 598 598 ··· 609 609 g_debug("process_event: called"); 610 610 qdict = qobject_to(QDict, json_parser_parse_err(tokens, NULL, &err)); 611 611 if (err || !qdict) { 612 - QDECREF(qdict); 612 + qobject_unref(qdict); 613 613 qdict = qdict_new(); 614 614 if (!err) { 615 615 g_warning("failed to parse event: unknown error"); ··· 626 626 process_command(s, qdict); 627 627 } else { 628 628 if (!qdict_haskey(qdict, "error")) { 629 - QDECREF(qdict); 629 + qobject_unref(qdict); 630 630 qdict = qdict_new(); 631 631 g_warning("unrecognized payload format"); 632 632 error_setg(&err, QERR_UNSUPPORTED); ··· 639 639 } 640 640 } 641 641 642 - QDECREF(qdict); 642 + qobject_unref(qdict); 643 643 } 644 644 645 645 /* false return signals GAChannel to close the current client connection */
+2 -2
qmp.c
··· 710 710 error_setg(errp, QERR_INVALID_PARAMETER_TYPE, "props", "dict"); 711 711 return; 712 712 } 713 - QINCREF(pdict); 713 + qobject_ref(pdict); 714 714 } else { 715 715 pdict = qdict_new(); 716 716 } ··· 721 721 if (obj) { 722 722 object_unref(obj); 723 723 } 724 - QDECREF(pdict); 724 + qobject_unref(pdict); 725 725 } 726 726 727 727 void qmp_object_del(const char *id, Error **errp)
+5 -5
qobject/json-parser.c
··· 222 222 return str; 223 223 224 224 out: 225 - QDECREF(str); 225 + qobject_unref(str); 226 226 return NULL; 227 227 } 228 228 ··· 311 311 312 312 qdict_put_obj(dict, qstring_get_str(key), value); 313 313 314 - QDECREF(key); 314 + qobject_unref(key); 315 315 316 316 return 0; 317 317 318 318 out: 319 - QDECREF(key); 319 + qobject_unref(key); 320 320 321 321 return -1; 322 322 } ··· 371 371 return QOBJECT(dict); 372 372 373 373 out: 374 - QDECREF(dict); 374 + qobject_unref(dict); 375 375 return NULL; 376 376 } 377 377 ··· 435 435 return QOBJECT(list); 436 436 437 437 out: 438 - QDECREF(list); 438 + qobject_unref(list); 439 439 return NULL; 440 440 } 441 441
+19 -19
qobject/qdict.c
··· 123 123 entry = qdict_find(qdict, key, bucket); 124 124 if (entry) { 125 125 /* replace key's value */ 126 - qobject_decref(entry->value); 126 + qobject_unref(entry->value); 127 127 entry->value = value; 128 128 } else { 129 129 /* allocate a new entry */ ··· 373 373 374 374 for (i = 0; i < QDICT_BUCKET_MAX; i++) { 375 375 QLIST_FOREACH(entry, &src->table[i], next) { 376 - qobject_incref(entry->value); 376 + qobject_ref(entry->value); 377 377 qdict_put_obj(dest, entry->key, entry->value); 378 378 } 379 379 } ··· 390 390 assert(e->key != NULL); 391 391 assert(e->value != NULL); 392 392 393 - qobject_decref(e->value); 393 + qobject_unref(e->value); 394 394 g_free(e->key); 395 395 g_free(e); 396 396 } ··· 480 480 481 481 val = qdict_get(src, key); 482 482 if (val) { 483 - qobject_incref(val); 483 + qobject_ref(val); 484 484 qdict_put_obj(dst, key, val); 485 485 } 486 486 } ··· 526 526 qdict_flatten_qlist(qobject_to(QList, value), target, new_key); 527 527 } else { 528 528 /* All other types are moved to the target unchanged. */ 529 - qobject_incref(value); 529 + qobject_ref(value); 530 530 qdict_put_obj(target, new_key, value); 531 531 } 532 532 ··· 566 566 delete = true; 567 567 } else if (prefix) { 568 568 /* All other objects are moved to the target unchanged. */ 569 - qobject_incref(value); 569 + qobject_ref(value); 570 570 qdict_put_obj(target, new_key, value); 571 571 delete = true; 572 572 } ··· 610 610 while (entry != NULL) { 611 611 next = qdict_next(src, entry); 612 612 if (strstart(entry->key, start, &p)) { 613 - qobject_incref(entry->value); 613 + qobject_ref(entry->value); 614 614 qdict_put_obj(*dst, p, entry->value); 615 615 qdict_del(src, entry->key); 616 616 } ··· 684 684 qdict_extract_subqdict(src, &subqdict, prefix); 685 685 assert(qdict_size(subqdict) > 0); 686 686 } else { 687 - qobject_incref(subqobj); 687 + qobject_ref(subqobj); 688 688 qdict_del(src, indexstr); 689 689 } 690 690 ··· 894 894 qdict_put_obj(two_level, prefix, QOBJECT(child_dict)); 895 895 } 896 896 897 - qobject_incref(ent->value); 897 + qobject_ref(ent->value); 898 898 qdict_put_obj(child_dict, suffix, ent->value); 899 899 } else { 900 900 if (child) { ··· 902 902 prefix); 903 903 goto error; 904 904 } 905 - qobject_incref(ent->value); 905 + qobject_ref(ent->value); 906 906 qdict_put_obj(two_level, prefix, ent->value); 907 907 } 908 908 ··· 924 924 925 925 qdict_put_obj(multi_level, ent->key, child); 926 926 } else { 927 - qobject_incref(ent->value); 927 + qobject_ref(ent->value); 928 928 qdict_put_obj(multi_level, ent->key, ent->value); 929 929 } 930 930 } 931 - QDECREF(two_level); 931 + qobject_unref(two_level); 932 932 two_level = NULL; 933 933 934 934 /* Step 3: detect if we need to turn our dict into list */ ··· 951 951 goto error; 952 952 } 953 953 954 - qobject_incref(child); 954 + qobject_ref(child); 955 955 qlist_append_obj(qobject_to(QList, dst), child); 956 956 } 957 - QDECREF(multi_level); 957 + qobject_unref(multi_level); 958 958 multi_level = NULL; 959 959 } else { 960 960 dst = QOBJECT(multi_level); ··· 964 964 965 965 error: 966 966 g_free(prefix); 967 - QDECREF(multi_level); 968 - QDECREF(two_level); 969 - qobject_decref(dst); 967 + qobject_unref(multi_level); 968 + qobject_unref(two_level); 969 + qobject_unref(dst); 970 970 return NULL; 971 971 } 972 972 ··· 1055 1055 next = qdict_next(src, entry); 1056 1056 1057 1057 if (overwrite || !qdict_haskey(dest, entry->key)) { 1058 - qobject_incref(entry->value); 1058 + qobject_ref(entry->value); 1059 1059 qdict_put_obj(dest, entry->key, entry->value); 1060 1060 qdict_del(src, entry->key); 1061 1061 } ··· 1088 1088 } 1089 1089 1090 1090 qobj = qdict_get(qdict, renames->from); 1091 - qobject_incref(qobj); 1091 + qobject_ref(qobj); 1092 1092 qdict_put_obj(qdict, renames->to, qobj); 1093 1093 qdict_del(qdict, renames->from); 1094 1094 }
+1 -1
qobject/qjson.c
··· 104 104 105 105 qkey = qstring_from_str(key); 106 106 to_json(QOBJECT(qkey), s->str, s->pretty, s->indent); 107 - QDECREF(qkey); 107 + qobject_unref(qkey); 108 108 109 109 qstring_append(s->str, ": "); 110 110 to_json(obj, s->str, s->pretty, s->indent);
+2 -2
qobject/qlist.c
··· 39 39 { 40 40 QList *dst = opaque; 41 41 42 - qobject_incref(obj); 42 + qobject_ref(obj); 43 43 qlist_append_obj(dst, obj); 44 44 } 45 45 ··· 196 196 197 197 QTAILQ_FOREACH_SAFE(entry, &qlist->head, next, next_entry) { 198 198 QTAILQ_REMOVE(&qlist->head, entry, next); 199 - qobject_decref(entry->value); 199 + qobject_unref(entry->value); 200 200 g_free(entry); 201 201 } 202 202
+8 -8
qom/object.c
··· 1129 1129 QString *qstr = qstring_from_str(value); 1130 1130 object_property_set_qobject(obj, QOBJECT(qstr), name, errp); 1131 1131 1132 - QDECREF(qstr); 1132 + qobject_unref(qstr); 1133 1133 } 1134 1134 1135 1135 char *object_property_get_str(Object *obj, const char *name, ··· 1147 1147 error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "string"); 1148 1148 } 1149 1149 1150 - qobject_decref(ret); 1150 + qobject_unref(ret); 1151 1151 return retval; 1152 1152 } 1153 1153 ··· 1187 1187 QBool *qbool = qbool_from_bool(value); 1188 1188 object_property_set_qobject(obj, QOBJECT(qbool), name, errp); 1189 1189 1190 - QDECREF(qbool); 1190 + qobject_unref(qbool); 1191 1191 } 1192 1192 1193 1193 bool object_property_get_bool(Object *obj, const char *name, ··· 1208 1208 retval = qbool_get_bool(qbool); 1209 1209 } 1210 1210 1211 - qobject_decref(ret); 1211 + qobject_unref(ret); 1212 1212 return retval; 1213 1213 } 1214 1214 ··· 1218 1218 QNum *qnum = qnum_from_int(value); 1219 1219 object_property_set_qobject(obj, QOBJECT(qnum), name, errp); 1220 1220 1221 - QDECREF(qnum); 1221 + qobject_unref(qnum); 1222 1222 } 1223 1223 1224 1224 int64_t object_property_get_int(Object *obj, const char *name, ··· 1238 1238 retval = -1; 1239 1239 } 1240 1240 1241 - qobject_decref(ret); 1241 + qobject_unref(ret); 1242 1242 return retval; 1243 1243 } 1244 1244 ··· 1248 1248 QNum *qnum = qnum_from_uint(value); 1249 1249 1250 1250 object_property_set_qobject(obj, QOBJECT(qnum), name, errp); 1251 - QDECREF(qnum); 1251 + qobject_unref(qnum); 1252 1252 } 1253 1253 1254 1254 uint64_t object_property_get_uint(Object *obj, const char *name, ··· 1267 1267 retval = 0; 1268 1268 } 1269 1269 1270 - qobject_decref(ret); 1270 + qobject_unref(ret); 1271 1271 return retval; 1272 1272 } 1273 1273
+1 -1
qom/object_interfaces.c
··· 140 140 qemu_opts_set_id(opts, (char *) id); 141 141 qemu_opt_set(opts, "qom-type", type, &error_abort); 142 142 g_free(type); 143 - QDECREF(pdict); 143 + qobject_unref(pdict); 144 144 return obj; 145 145 } 146 146
+4 -4
scripts/coccinelle/qobject.cocci
··· 3 3 expression Obj, Key, E; 4 4 @@ 5 5 ( 6 - - qobject_incref(QOBJECT(E)); 7 - + QINCREF(E); 6 + - qobject_ref(QOBJECT(E)); 7 + + qobject_ref(E); 8 8 | 9 - - qobject_decref(QOBJECT(E)); 10 - + QDECREF(E); 9 + - qobject_unref(QOBJECT(E)); 10 + + qobject_unref(E); 11 11 | 12 12 - qdict_put_obj(Obj, Key, QOBJECT(E)); 13 13 + qdict_put(Obj, Key, E);
+1 -1
scripts/qapi/events.py
··· 142 142 ''') 143 143 ret += mcgen(''' 144 144 error_propagate(errp, err); 145 - QDECREF(qmp); 145 + qobject_unref(qmp); 146 146 } 147 147 ''') 148 148 return ret
+1 -1
target/ppc/translate_init.c
··· 8347 8347 "use max-cpu-compat machine property instead"); 8348 8348 } 8349 8349 visit_type_null(v, name, &null, NULL); 8350 - QDECREF(null); 8350 + qobject_unref(null); 8351 8351 } 8352 8352 8353 8353 static const PropertyInfo ppc_compat_deprecated_propinfo = {
+1 -1
target/s390x/cpu_models.c
··· 551 551 } 552 552 553 553 if (!qdict_size(qdict)) { 554 - QDECREF(qdict); 554 + qobject_unref(qdict); 555 555 } else { 556 556 info->props = QOBJECT(qdict); 557 557 info->has_props = true;
+3 -3
tests/ahci-test.c
··· 1566 1566 } else { 1567 1567 g_assert(!qdict_get_bool(data, "tray-open")); 1568 1568 } 1569 - QDECREF(rsp); 1569 + qobject_unref(rsp); 1570 1570 } 1571 1571 1572 1572 static void test_atapi_tray(void) ··· 1596 1596 "'arguments': {'id': 'cd0'}}"); 1597 1597 atapi_wait_tray(true); 1598 1598 rsp = qmp_receive(); 1599 - QDECREF(rsp); 1599 + qobject_unref(rsp); 1600 1600 1601 1601 qmp_discard_response("{'execute': 'blockdev-remove-medium', " 1602 1602 "'arguments': {'id': 'cd0'}}"); ··· 1623 1623 "'arguments': {'id': 'cd0'}}"); 1624 1624 atapi_wait_tray(false); 1625 1625 rsp = qmp_receive(); 1626 - QDECREF(rsp); 1626 + qobject_unref(rsp); 1627 1627 1628 1628 /* Now, to convince ATAPI we understand the media has changed... */ 1629 1629 ahci_atapi_test_ready(ahci, port, false, SENSE_NOT_READY);
+50 -50
tests/check-qdict.c
··· 34 34 g_assert(qdict->base.refcnt == 1); 35 35 g_assert(qobject_type(QOBJECT(qdict)) == QTYPE_QDICT); 36 36 37 - QDECREF(qdict); 37 + qobject_unref(qdict); 38 38 } 39 39 40 40 static void qdict_put_obj_test(void) ··· 54 54 qn = qobject_to(QNum, ent->value); 55 55 g_assert_cmpint(qnum_get_int(qn), ==, num); 56 56 57 - QDECREF(qdict); 57 + qobject_unref(qdict); 58 58 } 59 59 60 60 static void qdict_destroy_simple_test(void) ··· 65 65 qdict_put_int(qdict, "num", 0); 66 66 qdict_put_str(qdict, "str", "foo"); 67 67 68 - QDECREF(qdict); 68 + qobject_unref(qdict); 69 69 } 70 70 71 71 static void qdict_get_test(void) ··· 84 84 qn = qobject_to(QNum, obj); 85 85 g_assert_cmpint(qnum_get_int(qn), ==, value); 86 86 87 - QDECREF(tests_dict); 87 + qobject_unref(tests_dict); 88 88 } 89 89 90 90 static void qdict_get_int_test(void) ··· 99 99 ret = qdict_get_int(tests_dict, key); 100 100 g_assert(ret == value); 101 101 102 - QDECREF(tests_dict); 102 + qobject_unref(tests_dict); 103 103 } 104 104 105 105 static void qdict_get_try_int_test(void) ··· 121 121 ret = qdict_get_try_int(tests_dict, "string", -42); 122 122 g_assert_cmpuint(ret, ==, -42); 123 123 124 - QDECREF(tests_dict); 124 + qobject_unref(tests_dict); 125 125 } 126 126 127 127 static void qdict_get_str_test(void) ··· 137 137 g_assert(p != NULL); 138 138 g_assert(strcmp(p, str) == 0); 139 139 140 - QDECREF(tests_dict); 140 + qobject_unref(tests_dict); 141 141 } 142 142 143 143 static void qdict_get_try_str_test(void) ··· 153 153 g_assert(p != NULL); 154 154 g_assert(strcmp(p, str) == 0); 155 155 156 - QDECREF(tests_dict); 156 + qobject_unref(tests_dict); 157 157 } 158 158 159 159 static void qdict_defaults_test(void) ··· 174 174 qdict_copy_default(copy, dict, "bar"); 175 175 g_assert_cmpstr(qdict_get_str(copy, "bar"), ==, "xyz"); 176 176 177 - QDECREF(copy); 178 - QDECREF(dict); 177 + qobject_unref(copy); 178 + qobject_unref(dict); 179 179 } 180 180 181 181 static void qdict_haskey_not_test(void) ··· 183 183 QDict *tests_dict = qdict_new(); 184 184 g_assert(qdict_haskey(tests_dict, "test") == 0); 185 185 186 - QDECREF(tests_dict); 186 + qobject_unref(tests_dict); 187 187 } 188 188 189 189 static void qdict_haskey_test(void) ··· 194 194 qdict_put_int(tests_dict, key, 0); 195 195 g_assert(qdict_haskey(tests_dict, key) == 1); 196 196 197 - QDECREF(tests_dict); 197 + qobject_unref(tests_dict); 198 198 } 199 199 200 200 static void qdict_del_test(void) ··· 210 210 g_assert(qdict_size(tests_dict) == 0); 211 211 g_assert(qdict_haskey(tests_dict, key) == 0); 212 212 213 - QDECREF(tests_dict); 213 + qobject_unref(tests_dict); 214 214 } 215 215 216 216 static void qobject_to_qdict_test(void) ··· 218 218 QDict *tests_dict = qdict_new(); 219 219 g_assert(qobject_to(QDict, QOBJECT(tests_dict)) == tests_dict); 220 220 221 - QDECREF(tests_dict); 221 + qobject_unref(tests_dict); 222 222 } 223 223 224 224 static void qdict_iterapi_test(void) ··· 250 250 251 251 g_assert(count == qdict_size(tests_dict)); 252 252 253 - QDECREF(tests_dict); 253 + qobject_unref(tests_dict); 254 254 } 255 255 256 256 static void qdict_flatten_test(void) ··· 325 325 326 326 g_assert(qdict_size(dict3) == 8); 327 327 328 - QDECREF(dict3); 328 + qobject_unref(dict3); 329 329 } 330 330 331 331 static void qdict_array_split_test(void) ··· 390 390 g_assert(int1); 391 391 g_assert(qlist_empty(test_list)); 392 392 393 - QDECREF(test_list); 393 + qobject_unref(test_list); 394 394 395 395 g_assert(qdict_get_int(dict1, "a") == 42); 396 396 g_assert(qdict_get_int(dict1, "b") == 23); 397 397 398 398 g_assert(qdict_size(dict1) == 2); 399 399 400 - QDECREF(dict1); 400 + qobject_unref(dict1); 401 401 402 402 g_assert(qdict_get_int(dict2, "x") == 0); 403 403 404 404 g_assert(qdict_size(dict2) == 1); 405 405 406 - QDECREF(dict2); 406 + qobject_unref(dict2); 407 407 408 408 g_assert_cmpint(qnum_get_int(int1), ==, 66); 409 409 410 - QDECREF(int1); 410 + qobject_unref(int1); 411 411 412 412 g_assert(qdict_get_int(test_dict, "4.y") == 1); 413 413 g_assert(qdict_get_int(test_dict, "o.o") == 7); 414 414 415 415 g_assert(qdict_size(test_dict) == 2); 416 416 417 - QDECREF(test_dict); 417 + qobject_unref(test_dict); 418 418 419 419 /* 420 420 * Test the split of ··· 455 455 g_assert(int1); 456 456 g_assert(qlist_empty(test_list)); 457 457 458 - QDECREF(test_list); 458 + qobject_unref(test_list); 459 459 460 460 g_assert_cmpint(qnum_get_int(int1), ==, 42); 461 461 462 - QDECREF(int1); 462 + qobject_unref(int1); 463 463 464 464 g_assert(qdict_get_int(test_dict, "1") == 23); 465 465 g_assert(qdict_get_int(test_dict, "1.x") == 84); 466 466 467 467 g_assert(qdict_size(test_dict) == 2); 468 468 469 - QDECREF(test_dict); 469 + qobject_unref(test_dict); 470 470 } 471 471 472 472 static void qdict_array_entries_test(void) ··· 493 493 g_assert_cmpint(qdict_array_entries(dict, "foo."), ==, 3); 494 494 g_assert_cmpint(qdict_array_entries(dict, ""), ==, -EINVAL); 495 495 496 - QDECREF(dict); 496 + qobject_unref(dict); 497 497 498 498 dict = qdict_new(); 499 499 qdict_put_int(dict, "1", 0); ··· 509 509 qdict_put_int(dict, "2.c", 0); 510 510 g_assert_cmpint(qdict_array_entries(dict, ""), ==, 3); 511 511 512 - QDECREF(dict); 512 + qobject_unref(dict); 513 513 } 514 514 515 515 static void qdict_join_test(void) ··· 587 587 } 588 588 while (overwrite ^= true); 589 589 590 - QDECREF(dict1); 591 - QDECREF(dict2); 590 + qobject_unref(dict1); 591 + qobject_unref(dict2); 592 592 } 593 593 594 594 static void qdict_crumple_test_recursive(void) ··· 634 634 g_assert_cmpint(qdict_size(rule), ==, 2); 635 635 g_assert_cmpstr("fred", ==, qdict_get_str(rule, "match")); 636 636 g_assert_cmpstr("allow", ==, qdict_get_str(rule, "policy")); 637 - QDECREF(rule); 637 + qobject_unref(rule); 638 638 639 639 rule = qobject_to(QDict, qlist_pop(rules)); 640 640 g_assert(rule); 641 641 g_assert_cmpint(qdict_size(rule), ==, 2); 642 642 g_assert_cmpstr("bob", ==, qdict_get_str(rule, "match")); 643 643 g_assert_cmpstr("deny", ==, qdict_get_str(rule, "policy")); 644 - QDECREF(rule); 644 + qobject_unref(rule); 645 645 646 646 /* With recursive crumpling, we should see all names unescaped */ 647 647 g_assert_cmpstr("acl0", ==, qdict_get_str(vnc, "acl.name")); 648 648 g_assert_cmpstr("acl0", ==, qdict_get_str(acl, "rule.name")); 649 649 650 - QDECREF(src); 651 - QDECREF(dst); 650 + qobject_unref(src); 651 + qobject_unref(dst); 652 652 } 653 653 654 654 static void qdict_crumple_test_empty(void) ··· 661 661 662 662 g_assert_cmpint(qdict_size(dst), ==, 0); 663 663 664 - QDECREF(src); 665 - QDECREF(dst); 664 + qobject_unref(src); 665 + qobject_unref(dst); 666 666 } 667 667 668 668 static int qdict_count_entries(QDict *dict) ··· 704 704 g_assert(qobject_type(qdict_get(copy, "nothing")) == QTYPE_QNULL); 705 705 g_assert_cmpint(qdict_count_entries(copy), ==, 5); 706 706 707 - QDECREF(copy); 707 + qobject_unref(copy); 708 708 709 709 /* Simple rename of all entries */ 710 710 renames = (QDictRenames[]) { ··· 731 731 g_assert(qobject_type(qdict_get(copy, "null")) == QTYPE_QNULL); 732 732 g_assert_cmpint(qdict_count_entries(copy), ==, 5); 733 733 734 - QDECREF(copy); 734 + qobject_unref(copy); 735 735 736 736 /* Renames are processed top to bottom */ 737 737 renames = (QDictRenames[]) { ··· 754 754 g_assert(!qdict_haskey(copy, "tmp")); 755 755 g_assert_cmpint(qdict_count_entries(copy), ==, 5); 756 756 757 - QDECREF(copy); 757 + qobject_unref(copy); 758 758 759 759 /* Conflicting rename */ 760 760 renames = (QDictRenames[]) { ··· 775 775 g_assert(qobject_type(qdict_get(copy, "nothing")) == QTYPE_QNULL); 776 776 g_assert_cmpint(qdict_count_entries(copy), ==, 5); 777 777 778 - QDECREF(copy); 778 + qobject_unref(copy); 779 779 780 780 /* Renames in an empty dict */ 781 781 renames = (QDictRenames[]) { ··· 783 783 { NULL , NULL } 784 784 }; 785 785 786 - QDECREF(dict); 786 + qobject_unref(dict); 787 787 dict = qdict_new(); 788 788 789 789 qdict_rename_keys(dict, renames, &error_abort); 790 790 g_assert(qdict_first(dict) == NULL); 791 791 792 - QDECREF(dict); 792 + qobject_unref(dict); 793 793 } 794 794 795 795 static void qdict_crumple_test_bad_inputs(void) ··· 806 806 g_assert(error != NULL); 807 807 error_free(error); 808 808 error = NULL; 809 - QDECREF(src); 809 + qobject_unref(src); 810 810 811 811 src = qdict_new(); 812 812 /* rule can't be both a list and a dict */ ··· 817 817 g_assert(error != NULL); 818 818 error_free(error); 819 819 error = NULL; 820 - QDECREF(src); 820 + qobject_unref(src); 821 821 822 822 src = qdict_new(); 823 823 /* The input should be flat, ie no dicts or lists */ ··· 828 828 g_assert(error != NULL); 829 829 error_free(error); 830 830 error = NULL; 831 - QDECREF(src); 831 + qobject_unref(src); 832 832 833 833 src = qdict_new(); 834 834 /* List indexes must not have gaps */ ··· 839 839 g_assert(error != NULL); 840 840 error_free(error); 841 841 error = NULL; 842 - QDECREF(src); 842 + qobject_unref(src); 843 843 844 844 src = qdict_new(); 845 845 /* List indexes must be in %zu format */ ··· 850 850 g_assert(error != NULL); 851 851 error_free(error); 852 852 error = NULL; 853 - QDECREF(src); 853 + qobject_unref(src); 854 854 } 855 855 856 856 /* ··· 871 871 872 872 g_assert(qdict_size(tests_dict) == 1); 873 873 874 - QDECREF(tests_dict); 874 + qobject_unref(tests_dict); 875 875 } 876 876 877 877 static void qdict_get_not_exists_test(void) ··· 879 879 QDict *tests_dict = qdict_new(); 880 880 g_assert(qdict_get(tests_dict, "foo") == NULL); 881 881 882 - QDECREF(tests_dict); 882 + qobject_unref(tests_dict); 883 883 } 884 884 885 885 /* ··· 951 951 952 952 g_assert(strcmp(str1, str2) == 0); 953 953 954 - QDECREF(value); 954 + qobject_unref(value); 955 955 } 956 956 957 957 // Delete everything ··· 962 962 break; 963 963 964 964 qdict_del(qdict, key); 965 - QDECREF(value); 965 + qobject_unref(value); 966 966 967 967 g_assert(qdict_haskey(qdict, key) == 0); 968 968 } 969 969 fclose(test_file); 970 970 971 971 g_assert(qdict_size(qdict) == 0); 972 - QDECREF(qdict); 972 + qobject_unref(qdict); 973 973 } 974 974 975 975 int main(int argc, char **argv)
+42 -42
tests/check-qjson.c
··· 67 67 if (test_cases[i].skip == 0) { 68 68 str = qobject_to_json(obj); 69 69 g_assert_cmpstr(qstring_get_str(str), ==, test_cases[i].encoded); 70 - qobject_decref(obj); 70 + qobject_unref(obj); 71 71 } 72 72 73 - QDECREF(str); 73 + qobject_unref(str); 74 74 } 75 75 } 76 76 ··· 99 99 str = qobject_to_json(obj); 100 100 g_assert(strcmp(qstring_get_str(str), test_cases[i].encoded) == 0); 101 101 102 - qobject_decref(obj); 102 + qobject_unref(obj); 103 103 104 - QDECREF(str); 104 + qobject_unref(str); 105 105 } 106 106 } 107 107 ··· 127 127 g_assert(str); 128 128 g_assert(strcmp(qstring_get_str(str), test_cases[i].decoded) == 0); 129 129 130 - QDECREF(str); 130 + qobject_unref(str); 131 131 } 132 132 } 133 133 ··· 823 823 } else { 824 824 g_assert(!obj); 825 825 } 826 - qobject_decref(obj); 826 + qobject_unref(obj); 827 827 828 828 obj = QOBJECT(qstring_from_str(utf8_in)); 829 829 str = qobject_to_json(obj); ··· 833 833 } else { 834 834 g_assert(!str); 835 835 } 836 - QDECREF(str); 837 - qobject_decref(obj); 836 + qobject_unref(str); 837 + qobject_unref(obj); 838 838 839 839 /* 840 840 * Disabled, because qobject_from_json() is buggy, and I can't ··· 869 869 g_assert(str); 870 870 g_assert(strcmp(qstring_get_str(str), test_cases[i].decoded) == 0); 871 871 872 - QDECREF(str); 872 + qobject_unref(str); 873 873 } 874 874 } 875 875 ··· 904 904 905 905 str = qobject_to_json(QOBJECT(qnum)); 906 906 g_assert(strcmp(qstring_get_str(str), test_cases[i].encoded) == 0); 907 - QDECREF(str); 907 + qobject_unref(str); 908 908 } 909 909 910 - QDECREF(qnum); 910 + qobject_unref(qnum); 911 911 } 912 912 } 913 913 ··· 928 928 929 929 str = qobject_to_json(QOBJECT(qnum)); 930 930 g_assert_cmpstr(qstring_get_str(str), ==, maxu64); 931 - QDECREF(str); 932 - QDECREF(qnum); 931 + qobject_unref(str); 932 + qobject_unref(qnum); 933 933 934 934 qnum = qobject_to(QNum, qobject_from_json(gtu64, &error_abort)); 935 935 g_assert(qnum); ··· 939 939 940 940 str = qobject_to_json(QOBJECT(qnum)); 941 941 g_assert_cmpstr(qstring_get_str(str), ==, gtu64); 942 - QDECREF(str); 943 - QDECREF(qnum); 942 + qobject_unref(str); 943 + qobject_unref(qnum); 944 944 945 945 qnum = qobject_to(QNum, qobject_from_json(lti64, &error_abort)); 946 946 g_assert(qnum); ··· 950 950 951 951 str = qobject_to_json(QOBJECT(qnum)); 952 952 g_assert_cmpstr(qstring_get_str(str), ==, "-9223372036854775808"); 953 - QDECREF(str); 954 - QDECREF(qnum); 953 + qobject_unref(str); 954 + qobject_unref(qnum); 955 955 } 956 956 957 957 static void float_number(void) ··· 983 983 984 984 str = qobject_to_json(obj); 985 985 g_assert(strcmp(qstring_get_str(str), test_cases[i].encoded) == 0); 986 - QDECREF(str); 986 + qobject_unref(str); 987 987 } 988 988 989 - QDECREF(qnum); 989 + qobject_unref(qnum); 990 990 } 991 991 } 992 992 ··· 1001 1001 qnum = qobject_to(QNum, qobject_from_jsonf("%d", value)); 1002 1002 g_assert(qnum_get_try_int(qnum, &val)); 1003 1003 g_assert_cmpint(val, ==, value); 1004 - QDECREF(qnum); 1004 + qobject_unref(qnum); 1005 1005 1006 1006 qnum = qobject_to(QNum, qobject_from_jsonf("%lld", value_ll)); 1007 1007 g_assert(qnum_get_try_int(qnum, &val)); 1008 1008 g_assert_cmpint(val, ==, value_ll); 1009 - QDECREF(qnum); 1009 + qobject_unref(qnum); 1010 1010 1011 1011 qnum = qobject_to(QNum, qobject_from_jsonf("%f", valuef)); 1012 1012 g_assert(qnum_get_double(qnum) == valuef); 1013 - QDECREF(qnum); 1013 + qobject_unref(qnum); 1014 1014 } 1015 1015 1016 1016 static void keyword_literal(void) ··· 1027 1027 1028 1028 str = qobject_to_json(obj); 1029 1029 g_assert(strcmp(qstring_get_str(str), "true") == 0); 1030 - QDECREF(str); 1030 + qobject_unref(str); 1031 1031 1032 - QDECREF(qbool); 1032 + qobject_unref(qbool); 1033 1033 1034 1034 obj = qobject_from_json("false", &error_abort); 1035 1035 qbool = qobject_to(QBool, obj); ··· 1038 1038 1039 1039 str = qobject_to_json(obj); 1040 1040 g_assert(strcmp(qstring_get_str(str), "false") == 0); 1041 - QDECREF(str); 1041 + qobject_unref(str); 1042 1042 1043 - QDECREF(qbool); 1043 + qobject_unref(qbool); 1044 1044 1045 1045 qbool = qobject_to(QBool, qobject_from_jsonf("%i", false)); 1046 1046 g_assert(qbool); 1047 1047 g_assert(qbool_get_bool(qbool) == false); 1048 - QDECREF(qbool); 1048 + qobject_unref(qbool); 1049 1049 1050 1050 /* Test that non-zero values other than 1 get collapsed to true */ 1051 1051 qbool = qobject_to(QBool, qobject_from_jsonf("%i", 2)); 1052 1052 g_assert(qbool); 1053 1053 g_assert(qbool_get_bool(qbool) == true); 1054 - QDECREF(qbool); 1054 + qobject_unref(qbool); 1055 1055 1056 1056 obj = qobject_from_json("null", &error_abort); 1057 1057 g_assert(obj != NULL); ··· 1060 1060 null = qnull(); 1061 1061 g_assert(QOBJECT(null) == obj); 1062 1062 1063 - qobject_decref(obj); 1064 - QDECREF(null); 1063 + qobject_unref(obj); 1064 + qobject_unref(null); 1065 1065 } 1066 1066 1067 1067 static void simple_dict(void) ··· 1101 1101 g_assert(qlit_equal_qobject(&test_cases[i].decoded, obj)); 1102 1102 1103 1103 str = qobject_to_json(obj); 1104 - qobject_decref(obj); 1104 + qobject_unref(obj); 1105 1105 1106 1106 obj = qobject_from_json(qstring_get_str(str), &error_abort); 1107 1107 g_assert(qlit_equal_qobject(&test_cases[i].decoded, obj)); 1108 - qobject_decref(obj); 1109 - QDECREF(str); 1108 + qobject_unref(obj); 1109 + qobject_unref(str); 1110 1110 } 1111 1111 } 1112 1112 ··· 1158 1158 obj = qobject_from_json(gstr->str, &error_abort); 1159 1159 g_assert(obj != NULL); 1160 1160 1161 - qobject_decref(obj); 1161 + qobject_unref(obj); 1162 1162 g_string_free(gstr, true); 1163 1163 } 1164 1164 ··· 1210 1210 g_assert(qlit_equal_qobject(&test_cases[i].decoded, obj)); 1211 1211 1212 1212 str = qobject_to_json(obj); 1213 - qobject_decref(obj); 1213 + qobject_unref(obj); 1214 1214 1215 1215 obj = qobject_from_json(qstring_get_str(str), &error_abort); 1216 1216 g_assert(qlit_equal_qobject(&test_cases[i].decoded, obj)); 1217 - qobject_decref(obj); 1218 - QDECREF(str); 1217 + qobject_unref(obj); 1218 + qobject_unref(str); 1219 1219 } 1220 1220 } 1221 1221 ··· 1272 1272 g_assert(qlit_equal_qobject(&test_cases[i].decoded, obj)); 1273 1273 1274 1274 str = qobject_to_json(obj); 1275 - qobject_decref(obj); 1275 + qobject_unref(obj); 1276 1276 1277 1277 obj = qobject_from_json(qstring_get_str(str), &error_abort); 1278 1278 g_assert(qlit_equal_qobject(&test_cases[i].decoded, obj)); 1279 1279 1280 - qobject_decref(obj); 1281 - QDECREF(str); 1280 + qobject_unref(obj); 1281 + qobject_unref(str); 1282 1282 } 1283 1283 } 1284 1284 ··· 1301 1301 obj = qobject_from_jsonf("[%d, 2, %p]", 1, embedded_obj); 1302 1302 g_assert(qlit_equal_qobject(&decoded, obj)); 1303 1303 1304 - qobject_decref(obj); 1304 + qobject_unref(obj); 1305 1305 } 1306 1306 1307 1307 static void empty_input(void) ··· 1410 1410 1411 1411 obj = qobject_from_json(make_nest(buf, max_nesting), &error_abort); 1412 1412 g_assert(obj != NULL); 1413 - qobject_decref(obj); 1413 + qobject_unref(obj); 1414 1414 1415 1415 obj = qobject_from_json(make_nest(buf, max_nesting + 1), &err); 1416 1416 error_free_or_abort(&err);
+4 -4
tests/check-qlist.c
··· 29 29 g_assert(qlist->base.refcnt == 1); 30 30 g_assert(qobject_type(QOBJECT(qlist)) == QTYPE_QLIST); 31 31 32 - QDECREF(qlist); 32 + qobject_unref(qlist); 33 33 } 34 34 35 35 static void qlist_append_test(void) ··· 47 47 g_assert(entry != NULL); 48 48 g_assert(entry->value == QOBJECT(qi)); 49 49 50 - QDECREF(qlist); 50 + qobject_unref(qlist); 51 51 } 52 52 53 53 static void qobject_to_qlist_test(void) ··· 58 58 59 59 g_assert(qobject_to(QList, QOBJECT(qlist)) == qlist); 60 60 61 - QDECREF(qlist); 61 + qobject_unref(qlist); 62 62 } 63 63 64 64 static int iter_called; ··· 96 96 97 97 g_assert(iter_called == iter_max); 98 98 99 - QDECREF(qlist); 99 + qobject_unref(qlist); 100 100 } 101 101 102 102 int main(int argc, char **argv)
+5 -5
tests/check-qlit.c
··· 62 62 qdict_put(qobject_to(QDict, qobj), "bee", qlist_new()); 63 63 g_assert(!qlit_equal_qobject(&qlit, qobj)); 64 64 65 - qobject_decref(qobj); 65 + qobject_unref(qobj); 66 66 } 67 67 68 68 static void qobject_from_qlit_test(void) ··· 79 79 bee = qdict_get_qlist(qdict, "bee"); 80 80 obj = qlist_pop(bee); 81 81 g_assert_cmpint(qnum_get_int(qobject_to(QNum, obj)), ==, 43); 82 - qobject_decref(obj); 82 + qobject_unref(obj); 83 83 obj = qlist_pop(bee); 84 84 g_assert_cmpint(qnum_get_int(qobject_to(QNum, obj)), ==, 44); 85 - qobject_decref(obj); 85 + qobject_unref(obj); 86 86 obj = qlist_pop(bee); 87 87 g_assert(qbool_get_bool(qobject_to(QBool, obj))); 88 - qobject_decref(obj); 88 + qobject_unref(obj); 89 89 90 - qobject_decref(qobj); 90 + qobject_unref(qobj); 91 91 } 92 92 93 93 int main(int argc, char **argv)
+5 -5
tests/check-qnull.c
··· 30 30 g_assert(obj == QOBJECT(&qnull_)); 31 31 g_assert(qnull_.base.refcnt == 2); 32 32 g_assert(qobject_type(obj) == QTYPE_QNULL); 33 - qobject_decref(obj); 33 + qobject_unref(obj); 34 34 g_assert(qnull_.base.refcnt == 1); 35 35 } 36 36 ··· 49 49 g_assert(qnull_.base.refcnt == 1); 50 50 obj = QOBJECT(qnull()); 51 51 v = qobject_input_visitor_new(obj); 52 - qobject_decref(obj); 52 + qobject_unref(obj); 53 53 visit_type_null(v, NULL, &null, &error_abort); 54 54 g_assert(obj == QOBJECT(&qnull_)); 55 - QDECREF(null); 55 + qobject_unref(null); 56 56 visit_free(v); 57 57 58 58 null = NULL; ··· 60 60 visit_type_null(v, NULL, &null, &error_abort); 61 61 visit_complete(v, &obj); 62 62 g_assert(obj == QOBJECT(&qnull_)); 63 - QDECREF(null); 64 - qobject_decref(obj); 63 + qobject_unref(null); 64 + qobject_unref(obj); 65 65 visit_free(v); 66 66 67 67 g_assert(qnull_.base.refcnt == 1);
+14 -14
tests/check-qnum.c
··· 35 35 g_assert_cmpint(qn->base.refcnt, ==, 1); 36 36 g_assert_cmpint(qobject_type(QOBJECT(qn)), ==, QTYPE_QNUM); 37 37 38 - QDECREF(qn); 38 + qobject_unref(qn); 39 39 } 40 40 41 41 static void qnum_from_uint_test(void) ··· 50 50 g_assert(qn->base.refcnt == 1); 51 51 g_assert(qobject_type(QOBJECT(qn)) == QTYPE_QNUM); 52 52 53 - QDECREF(qn); 53 + qobject_unref(qn); 54 54 } 55 55 56 56 static void qnum_from_double_test(void) ··· 65 65 g_assert_cmpint(qn->base.refcnt, ==, 1); 66 66 g_assert_cmpint(qobject_type(QOBJECT(qn)), ==, QTYPE_QNUM); 67 67 68 - QDECREF(qn); 68 + qobject_unref(qn); 69 69 } 70 70 71 71 static void qnum_from_int64_test(void) ··· 76 76 qn = qnum_from_int(value); 77 77 g_assert_cmpint((int64_t) qn->u.i64, ==, value); 78 78 79 - QDECREF(qn); 79 + qobject_unref(qn); 80 80 } 81 81 82 82 static void qnum_get_int_test(void) ··· 87 87 qn = qnum_from_int(value); 88 88 g_assert_cmpint(qnum_get_int(qn), ==, value); 89 89 90 - QDECREF(qn); 90 + qobject_unref(qn); 91 91 } 92 92 93 93 static void qnum_get_uint_test(void) ··· 100 100 qn = qnum_from_uint(value); 101 101 g_assert(qnum_get_try_uint(qn, &val)); 102 102 g_assert_cmpuint(val, ==, value); 103 - QDECREF(qn); 103 + qobject_unref(qn); 104 104 105 105 qn = qnum_from_int(value); 106 106 g_assert(qnum_get_try_uint(qn, &val)); 107 107 g_assert_cmpuint(val, ==, value); 108 - QDECREF(qn); 108 + qobject_unref(qn); 109 109 110 110 /* invalid cases */ 111 111 qn = qnum_from_int(-1); 112 112 g_assert(!qnum_get_try_uint(qn, &val)); 113 - QDECREF(qn); 113 + qobject_unref(qn); 114 114 115 115 qn = qnum_from_uint(-1ULL); 116 116 g_assert(!qnum_get_try_int(qn, &ival)); 117 - QDECREF(qn); 117 + qobject_unref(qn); 118 118 119 119 qn = qnum_from_double(0.42); 120 120 g_assert(!qnum_get_try_uint(qn, &val)); 121 - QDECREF(qn); 121 + qobject_unref(qn); 122 122 } 123 123 124 124 static void qobject_to_qnum_test(void) ··· 127 127 128 128 qn = qnum_from_int(0); 129 129 g_assert(qobject_to(QNum, QOBJECT(qn)) == qn); 130 - QDECREF(qn); 130 + qobject_unref(qn); 131 131 132 132 qn = qnum_from_double(0); 133 133 g_assert(qobject_to(QNum, QOBJECT(qn)) == qn); 134 - QDECREF(qn); 134 + qobject_unref(qn); 135 135 } 136 136 137 137 static void qnum_to_string_test(void) ··· 143 143 tmp = qnum_to_string(qn); 144 144 g_assert_cmpstr(tmp, ==, "123456"); 145 145 g_free(tmp); 146 - QDECREF(qn); 146 + qobject_unref(qn); 147 147 148 148 qn = qnum_from_double(0.42); 149 149 tmp = qnum_to_string(qn); 150 150 g_assert_cmpstr(tmp, ==, "0.42"); 151 151 g_free(tmp); 152 - QDECREF(qn); 152 + qobject_unref(qn); 153 153 } 154 154 155 155 int main(int argc, char **argv)
+1 -1
tests/check-qobject.c
··· 80 80 81 81 va_start(ap, _); 82 82 while ((obj = va_arg(ap, QObject *)) != NULL) { 83 - qobject_decref(obj); 83 + qobject_unref(obj); 84 84 } 85 85 va_end(ap); 86 86 }
+5 -5
tests/check-qstring.c
··· 31 31 g_assert(strcmp(str, qstring->string) == 0); 32 32 g_assert(qobject_type(QOBJECT(qstring)) == QTYPE_QSTRING); 33 33 34 - QDECREF(qstring); 34 + qobject_unref(qstring); 35 35 } 36 36 37 37 static void qstring_get_str_test(void) ··· 44 44 ret_str = qstring_get_str(qstring); 45 45 g_assert(strcmp(ret_str, str) == 0); 46 46 47 - QDECREF(qstring); 47 + qobject_unref(qstring); 48 48 } 49 49 50 50 static void qstring_append_chr_test(void) ··· 59 59 qstring_append_chr(qstring, str[i]); 60 60 61 61 g_assert(strcmp(str, qstring_get_str(qstring)) == 0); 62 - QDECREF(qstring); 62 + qobject_unref(qstring); 63 63 } 64 64 65 65 static void qstring_from_substr_test(void) ··· 70 70 g_assert(qs != NULL); 71 71 g_assert(strcmp(qstring_get_str(qs), "tualiza") == 0); 72 72 73 - QDECREF(qs); 73 + qobject_unref(qs); 74 74 } 75 75 76 76 ··· 81 81 qstring = qstring_from_str("foo"); 82 82 g_assert(qobject_to(QString, QOBJECT(qstring)) == qstring); 83 83 84 - QDECREF(qstring); 84 + qobject_unref(qstring); 85 85 } 86 86 87 87 int main(int argc, char **argv)
+2 -2
tests/cpu-plug-test.c
··· 42 42 " 'arguments': { 'id': %d } }", i); 43 43 g_assert(response); 44 44 g_assert(!qdict_haskey(response, "error")); 45 - QDECREF(response); 45 + qobject_unref(response); 46 46 } 47 47 48 48 qtest_end(); ··· 66 66 s->sockets * s->cores * s->threads); 67 67 g_assert(response); 68 68 g_assert(qdict_haskey(response, "error")); 69 - QDECREF(response); 69 + qobject_unref(response); 70 70 71 71 qtest_end(); 72 72 g_free(args);
+12 -12
tests/device-introspect-test.c
··· 40 40 " 'arguments': %p }", args); 41 41 g_assert(qdict_haskey(resp, "return")); 42 42 ret = qdict_get_qlist(resp, "return"); 43 - QINCREF(ret); 44 - QDECREF(resp); 43 + qobject_ref(ret); 44 + qobject_unref(resp); 45 45 return ret; 46 46 } 47 47 ··· 54 54 QLIST_FOREACH_ENTRY(types, e) { 55 55 QDict *d = qobject_to(QDict, qlist_entry_obj(e)); 56 56 const char *name = qdict_get_str(d, "name"); 57 - QINCREF(d); 57 + qobject_ref(d); 58 58 qdict_put(index, name, d); 59 59 } 60 60 return index; ··· 108 108 resp = qmp("{'execute': 'device-list-properties'," 109 109 " 'arguments': {'typename': %s}}", 110 110 type); 111 - QDECREF(resp); 111 + qobject_unref(resp); 112 112 113 113 help = hmp("device_add \"%s,help\"", type); 114 114 g_free(help); ··· 129 129 qtest_start(common_args); 130 130 131 131 types = device_type_list(true); 132 - QDECREF(types); 132 + qobject_unref(types); 133 133 134 134 help = hmp("device_add help"); 135 135 g_free(help); ··· 157 157 g_assert(qom_has_parent(index, name, parent)); 158 158 } 159 159 160 - QDECREF(types); 161 - QDECREF(index); 160 + qobject_unref(types); 161 + qobject_unref(index); 162 162 } 163 163 164 164 static void test_qom_list_fields(void) ··· 187 187 test_qom_list_parents("device"); 188 188 test_qom_list_parents("sys-bus-device"); 189 189 190 - QDECREF(all_types); 191 - QDECREF(non_abstract); 190 + qobject_unref(all_types); 191 + qobject_unref(non_abstract); 192 192 qtest_end(); 193 193 } 194 194 ··· 222 222 test_one_device(type); 223 223 } 224 224 225 - QDECREF(types); 225 + qobject_unref(types); 226 226 qtest_end(); 227 227 } 228 228 ··· 255 255 g_assert(qdict_haskey(d, "abstract") && qdict_get_bool(d, "abstract")); 256 256 } 257 257 258 - QDECREF(all_types); 259 - QDECREF(index); 258 + qobject_unref(all_types); 259 + qobject_unref(index); 260 260 qtest_end(); 261 261 } 262 262
+2 -2
tests/drive_del-test.c
··· 41 41 response = qmp_receive(); 42 42 g_assert(response); 43 43 g_assert(qdict_haskey(response, "return")); 44 - QDECREF(response); 44 + qobject_unref(response); 45 45 } 46 46 47 47 static void test_drive_without_dev(void) ··· 78 78 g_assert(response); 79 79 error = qdict_get_qdict(response, "error"); 80 80 g_assert_cmpstr(qdict_get_try_str(error, "class"), ==, "GenericError"); 81 - QDECREF(response); 81 + qobject_unref(response); 82 82 83 83 /* Delete the drive */ 84 84 drive_del();
+4 -4
tests/libqos/libqos.c
··· 100 100 sub = qdict_get_qdict(rsp, "return"); 101 101 g_assert(qdict_haskey(sub, "running")); 102 102 running = qdict_get_bool(sub, "running"); 103 - QDECREF(rsp); 103 + qobject_unref(rsp); 104 104 105 105 /* Issue the migrate command. */ 106 106 rsp = qtest_qmp(from->qts, 107 107 "{ 'execute': 'migrate', 'arguments': { 'uri': %s }}", 108 108 uri); 109 109 g_assert(qdict_haskey(rsp, "return")); 110 - QDECREF(rsp); 110 + qobject_unref(rsp); 111 111 112 112 /* Wait for STOP event, but only if we were running: */ 113 113 if (running) { ··· 132 132 133 133 /* "setup", "active", "completed", "failed", "cancelled" */ 134 134 if (strcmp(st, "completed") == 0) { 135 - QDECREF(rsp); 135 + qobject_unref(rsp); 136 136 break; 137 137 } 138 138 139 139 if ((strcmp(st, "setup") == 0) || (strcmp(st, "active") == 0)) { 140 - QDECREF(rsp); 140 + qobject_unref(rsp); 141 141 g_usleep(5000); 142 142 continue; 143 143 }
+1 -1
tests/libqos/pci-pc.c
··· 170 170 g_free(cmd); 171 171 g_assert(response); 172 172 g_assert(!qdict_haskey(response, "error")); 173 - QDECREF(response); 173 + qobject_unref(response); 174 174 175 175 outb(ACPI_PCIHP_ADDR + PCI_EJ_BASE, 1 << slot); 176 176
+12 -12
tests/libqtest.c
··· 517 517 /* Send QMP request */ 518 518 socket_send(fd, str, qstring_get_length(qstr)); 519 519 520 - QDECREF(qstr); 521 - qobject_decref(qobj); 520 + qobject_unref(qstr); 521 + qobject_unref(qobj); 522 522 } 523 523 } 524 524 ··· 585 585 void qtest_qmpv_discard_response(QTestState *s, const char *fmt, va_list ap) 586 586 { 587 587 QDict *response = qtest_qmpv(s, fmt, ap); 588 - QDECREF(response); 588 + qobject_unref(response); 589 589 } 590 590 591 591 void qtest_qmp_discard_response(QTestState *s, const char *fmt, ...) ··· 596 596 va_start(ap, fmt); 597 597 response = qtest_qmpv(s, fmt, ap); 598 598 va_end(ap); 599 - QDECREF(response); 599 + qobject_unref(response); 600 600 } 601 601 602 602 QDict *qtest_qmp_eventwait_ref(QTestState *s, const char *event) ··· 609 609 (strcmp(qdict_get_str(response, "event"), event) == 0)) { 610 610 return response; 611 611 } 612 - QDECREF(response); 612 + qobject_unref(response); 613 613 } 614 614 } 615 615 ··· 618 618 QDict *response; 619 619 620 620 response = qtest_qmp_eventwait_ref(s, event); 621 - QDECREF(response); 621 + qobject_unref(response); 622 622 } 623 623 624 624 char *qtest_hmpv(QTestState *s, const char *fmt, va_list ap) ··· 634 634 ret = g_strdup(qdict_get_try_str(resp, "return")); 635 635 while (ret == NULL && qdict_get_try_str(resp, "event")) { 636 636 /* Ignore asynchronous QMP events */ 637 - QDECREF(resp); 637 + qobject_unref(resp); 638 638 resp = qtest_qmp_receive(s); 639 639 ret = g_strdup(qdict_get_try_str(resp, "return")); 640 640 } 641 641 g_assert(ret); 642 - QDECREF(resp); 642 + qobject_unref(resp); 643 643 g_free(cmd); 644 644 return ret; 645 645 } ··· 1021 1021 } 1022 1022 1023 1023 qtest_end(); 1024 - QDECREF(response); 1024 + qobject_unref(response); 1025 1025 } 1026 1026 1027 1027 /* ··· 1050 1050 g_assert(response); 1051 1051 g_assert(!qdict_haskey(response, "event")); /* We don't expect any events */ 1052 1052 g_assert(!qdict_haskey(response, "error")); 1053 - QDECREF(response); 1053 + qobject_unref(response); 1054 1054 } 1055 1055 1056 1056 /* ··· 1095 1095 g_assert(event); 1096 1096 g_assert_cmpstr(qdict_get_str(event, "event"), ==, "DEVICE_DELETED"); 1097 1097 1098 - QDECREF(response1); 1099 - QDECREF(response2); 1098 + qobject_unref(response1); 1099 + qobject_unref(response2); 1100 1100 }
+1 -1
tests/machine-none-test.c
··· 88 88 89 89 response = qmp("{ 'execute': 'quit' }"); 90 90 g_assert(qdict_haskey(response, "return")); 91 - QDECREF(response); 91 + qobject_unref(response); 92 92 93 93 qtest_quit(global_qtest); 94 94 }
+13 -13
tests/migration-test.c
··· 195 195 if (!strcmp(event_string, "STOP")) { 196 196 got_stop = true; 197 197 } 198 - QDECREF(response); 198 + qobject_unref(response); 199 199 response = qtest_qmp_receive(who); 200 200 } 201 201 return response; ··· 221 221 rsp_ram = qdict_get_qdict(rsp_return, "ram"); 222 222 result = qdict_get_try_int(rsp_ram, "dirty-sync-count", 0); 223 223 } 224 - QDECREF(rsp); 224 + qobject_unref(rsp); 225 225 return result; 226 226 } 227 227 ··· 232 232 rsp = wait_command(who, "{ 'execute': 'query-migrate' }"); 233 233 rsp_return = qdict_get_qdict(rsp, "return"); 234 234 g_assert(qdict_haskey(rsp_return, "postcopy-blocktime")); 235 - QDECREF(rsp); 235 + qobject_unref(rsp); 236 236 } 237 237 238 238 static void wait_for_migration_complete(QTestState *who) ··· 247 247 status = qdict_get_str(rsp_return, "status"); 248 248 completed = strcmp(status, "completed") == 0; 249 249 g_assert_cmpstr(status, !=, "failed"); 250 - QDECREF(rsp); 250 + qobject_unref(rsp); 251 251 if (completed) { 252 252 return; 253 253 } ··· 334 334 qdict_get_try_int(rsp_return, parameter, -1)); 335 335 g_assert_cmpstr(result, ==, value); 336 336 g_free(result); 337 - QDECREF(rsp); 337 + qobject_unref(rsp); 338 338 } 339 339 340 340 static void migrate_set_parameter(QTestState *who, const char *parameter, ··· 349 349 rsp = qtest_qmp(who, cmd); 350 350 g_free(cmd); 351 351 g_assert(qdict_haskey(rsp, "return")); 352 - QDECREF(rsp); 352 + qobject_unref(rsp); 353 353 migrate_check_parameter(who, parameter, value); 354 354 } 355 355 ··· 367 367 rsp = qtest_qmp(who, cmd); 368 368 g_free(cmd); 369 369 g_assert(qdict_haskey(rsp, "return")); 370 - QDECREF(rsp); 370 + qobject_unref(rsp); 371 371 } 372 372 373 373 static void migrate(QTestState *who, const char *uri) ··· 381 381 rsp = qtest_qmp(who, cmd); 382 382 g_free(cmd); 383 383 g_assert(qdict_haskey(rsp, "return")); 384 - QDECREF(rsp); 384 + qobject_unref(rsp); 385 385 } 386 386 387 387 static void migrate_start_postcopy(QTestState *who) ··· 390 390 391 391 rsp = wait_command(who, "{ 'execute': 'migrate-start-postcopy' }"); 392 392 g_assert(qdict_haskey(rsp, "return")); 393 - QDECREF(rsp); 393 + qobject_unref(rsp); 394 394 } 395 395 396 396 static void test_migrate_start(QTestState **from, QTestState **to, ··· 503 503 rsp = qtest_qmp(who, cmd); 504 504 g_free(cmd); 505 505 g_assert(qdict_haskey(rsp, "return")); 506 - QDECREF(rsp); 506 + qobject_unref(rsp); 507 507 result_int = value * 1000L; 508 508 expected = g_strdup_printf("%" PRId64, result_int); 509 509 migrate_check_parameter(who, "downtime-limit", expected); ··· 520 520 rsp = qtest_qmp(who, cmd); 521 521 g_free(cmd); 522 522 g_assert(qdict_haskey(rsp, "return")); 523 - QDECREF(rsp); 523 + qobject_unref(rsp); 524 524 migrate_check_parameter(who, "max-bandwidth", value); 525 525 } 526 526 ··· 597 597 598 598 g_assert(!strcmp(status, "setup") || !(strcmp(status, "failed"))); 599 599 failed = !strcmp(status, "failed"); 600 - QDECREF(rsp); 600 + qobject_unref(rsp); 601 601 } while (!failed); 602 602 603 603 /* Is the machine currently running? */ ··· 606 606 rsp_return = qdict_get_qdict(rsp, "return"); 607 607 g_assert(qdict_haskey(rsp_return, "running")); 608 608 g_assert(qdict_get_bool(rsp_return, "running")); 609 - QDECREF(rsp); 609 + qobject_unref(rsp); 610 610 611 611 test_migrate_end(from, to, false); 612 612 }
+8 -8
tests/numa-test.c
··· 111 111 } else { 112 112 g_assert_cmpint(node, ==, 1); 113 113 } 114 - qobject_decref(e); 114 + qobject_unref(e); 115 115 } 116 116 117 - QDECREF(resp); 117 + qobject_unref(resp); 118 118 qtest_end(); 119 119 g_free(cli); 120 120 } ··· 164 164 } else { 165 165 g_assert(false); 166 166 } 167 - qobject_decref(e); 167 + qobject_unref(e); 168 168 } 169 169 170 - QDECREF(resp); 170 + qobject_unref(resp); 171 171 qtest_end(); 172 172 g_free(cli); 173 173 } ··· 209 209 } else { 210 210 g_assert(false); 211 211 } 212 - qobject_decref(e); 212 + qobject_unref(e); 213 213 } 214 214 215 - QDECREF(resp); 215 + qobject_unref(resp); 216 216 qtest_end(); 217 217 g_free(cli); 218 218 } ··· 252 252 } else { 253 253 g_assert(false); 254 254 } 255 - qobject_decref(e); 255 + qobject_unref(e); 256 256 } 257 257 258 - QDECREF(resp); 258 + qobject_unref(resp); 259 259 qtest_end(); 260 260 g_free(cli); 261 261 }
+1 -1
tests/pvpanic-test.c
··· 28 28 data = qdict_get_qdict(response, "data"); 29 29 g_assert(qdict_haskey(data, "action")); 30 30 g_assert_cmpstr(qdict_get_str(data, "action"), ==, "pause"); 31 - QDECREF(response); 31 + qobject_unref(response); 32 32 } 33 33 34 34 int main(int argc, char **argv)
+1 -1
tests/q35-test.c
··· 109 109 response = qmp("{'execute': 'system_reset', 'arguments': {} }"); 110 110 g_assert(response); 111 111 g_assert(!qdict_haskey(response, "error")); 112 - QDECREF(response); 112 + qobject_unref(response); 113 113 114 114 /* check open is settable again */ 115 115 smram_set_bit(pcidev, MCH_HOST_BRIDGE_SMRAM_D_OPEN, false);
+19 -19
tests/qmp-test.c
··· 52 52 /* Not even a dictionary */ 53 53 resp = qtest_qmp(qts, "null"); 54 54 g_assert_cmpstr(get_error_class(resp), ==, "GenericError"); 55 - QDECREF(resp); 55 + qobject_unref(resp); 56 56 57 57 /* No "execute" key */ 58 58 resp = qtest_qmp(qts, "{}"); 59 59 g_assert_cmpstr(get_error_class(resp), ==, "GenericError"); 60 - QDECREF(resp); 60 + qobject_unref(resp); 61 61 62 62 /* "execute" isn't a string */ 63 63 resp = qtest_qmp(qts, "{ 'execute': true }"); 64 64 g_assert_cmpstr(get_error_class(resp), ==, "GenericError"); 65 - QDECREF(resp); 65 + qobject_unref(resp); 66 66 67 67 /* "arguments" isn't a dictionary */ 68 68 resp = qtest_qmp(qts, "{ 'execute': 'no-such-cmd', 'arguments': [] }"); 69 69 g_assert_cmpstr(get_error_class(resp), ==, "GenericError"); 70 - QDECREF(resp); 70 + qobject_unref(resp); 71 71 72 72 /* extra key */ 73 73 resp = qtest_qmp(qts, "{ 'execute': 'no-such-cmd', 'extra': true }"); 74 74 g_assert_cmpstr(get_error_class(resp), ==, "GenericError"); 75 - QDECREF(resp); 75 + qobject_unref(resp); 76 76 } 77 77 78 78 static void test_qmp_protocol(void) ··· 90 90 test_version(qdict_get(q, "version")); 91 91 capabilities = qdict_get_qlist(q, "capabilities"); 92 92 g_assert(capabilities && qlist_empty(capabilities)); 93 - QDECREF(resp); 93 + qobject_unref(resp); 94 94 95 95 /* Test valid command before handshake */ 96 96 resp = qtest_qmp(qts, "{ 'execute': 'query-version' }"); 97 97 g_assert_cmpstr(get_error_class(resp), ==, "CommandNotFound"); 98 - QDECREF(resp); 98 + qobject_unref(resp); 99 99 100 100 /* Test malformed commands before handshake */ 101 101 test_malformed(qts); ··· 104 104 resp = qtest_qmp(qts, "{ 'execute': 'qmp_capabilities' }"); 105 105 ret = qdict_get_qdict(resp, "return"); 106 106 g_assert(ret && !qdict_size(ret)); 107 - QDECREF(resp); 107 + qobject_unref(resp); 108 108 109 109 /* Test repeated handshake */ 110 110 resp = qtest_qmp(qts, "{ 'execute': 'qmp_capabilities' }"); 111 111 g_assert_cmpstr(get_error_class(resp), ==, "CommandNotFound"); 112 - QDECREF(resp); 112 + qobject_unref(resp); 113 113 114 114 /* Test valid command */ 115 115 resp = qtest_qmp(qts, "{ 'execute': 'query-version' }"); 116 116 test_version(qdict_get(resp, "return")); 117 - QDECREF(resp); 117 + qobject_unref(resp); 118 118 119 119 /* Test malformed commands */ 120 120 test_malformed(qts); ··· 124 124 ret = qdict_get_qdict(resp, "return"); 125 125 g_assert(ret); 126 126 g_assert_cmpstr(qdict_get_try_str(resp, "id"), ==, "cookie#1"); 127 - QDECREF(resp); 127 + qobject_unref(resp); 128 128 129 129 /* Test command failure with 'id' */ 130 130 resp = qtest_qmp(qts, "{ 'execute': 'human-monitor-command', 'id': 2 }"); 131 131 g_assert_cmpstr(get_error_class(resp), ==, "GenericError"); 132 132 g_assert_cmpint(qdict_get_int(resp, "id"), ==, 2); 133 - QDECREF(resp); 133 + qobject_unref(resp); 134 134 135 135 qtest_quit(qts); 136 136 } ··· 159 159 qstr = qobject_to(QString, entry->value); 160 160 g_assert(qstr); 161 161 g_assert_cmpstr(qstring_get_str(qstr), ==, "oob"); 162 - QDECREF(resp); 162 + qobject_unref(resp); 163 163 164 164 /* Try a fake capability, it should fail. */ 165 165 resp = qtest_qmp(qts, 166 166 "{ 'execute': 'qmp_capabilities', " 167 167 " 'arguments': { 'enable': [ 'cap-does-not-exist' ] } }"); 168 168 g_assert(qdict_haskey(resp, "error")); 169 - QDECREF(resp); 169 + qobject_unref(resp); 170 170 171 171 /* Now, enable OOB in current QMP session, it should succeed. */ 172 172 resp = qtest_qmp(qts, 173 173 "{ 'execute': 'qmp_capabilities', " 174 174 " 'arguments': { 'enable': [ 'oob' ] } }"); 175 175 g_assert(qdict_haskey(resp, "return")); 176 - QDECREF(resp); 176 + qobject_unref(resp); 177 177 178 178 /* 179 179 * Try any command that does not support OOB but with OOB flag. We ··· 183 183 "{ 'execute': 'query-cpus'," 184 184 " 'control': { 'run-oob': true } }"); 185 185 g_assert(qdict_haskey(resp, "error")); 186 - QDECREF(resp); 186 + qobject_unref(resp); 187 187 188 188 /* 189 189 * First send the "x-oob-test" command with lock=true and ··· 210 210 !g_strcmp0(cmd_id, "unlock-cmd")) { 211 211 acks++; 212 212 } 213 - QDECREF(resp); 213 + qobject_unref(resp); 214 214 } 215 215 216 216 qtest_quit(qts); ··· 271 271 -1, &error_abort), 272 272 ==, expected_error_class); 273 273 } 274 - QDECREF(resp); 274 + qobject_unref(resp); 275 275 276 276 qtest_end(); 277 277 } ··· 321 321 visit_type_SchemaInfoList(qiv, NULL, &schema->list, &error_abort); 322 322 visit_free(qiv); 323 323 324 - QDECREF(resp); 324 + qobject_unref(resp); 325 325 qtest_end(); 326 326 327 327 schema->hash = g_hash_table_new(g_str_hash, g_str_equal);
+4 -4
tests/qom-test.c
··· 57 57 g_assert(response); 58 58 59 59 if (!recurse) { 60 - QDECREF(response); 60 + qobject_unref(response); 61 61 return; 62 62 } 63 63 ··· 82 82 path, prop); 83 83 /* qom-get may fail but should not, e.g., segfault. */ 84 84 g_assert(tmp); 85 - QDECREF(tmp); 85 + qobject_unref(tmp); 86 86 } 87 87 } 88 - QDECREF(response); 88 + qobject_unref(response); 89 89 } 90 90 91 91 static void test_machine(gconstpointer data) ··· 101 101 102 102 response = qmp("{ 'execute': 'quit' }"); 103 103 g_assert(qdict_haskey(response, "return")); 104 - QDECREF(response); 104 + qobject_unref(response); 105 105 106 106 qtest_end(); 107 107 g_free(args);
+6 -6
tests/tco-test.c
··· 241 241 QDict *data; 242 242 243 243 data = qdict_get_qdict(ev, "data"); 244 - QINCREF(data); 245 - QDECREF(ev); 244 + qobject_ref(data); 245 + qobject_unref(ev); 246 246 return data; 247 247 } 248 248 ··· 265 265 clock_step(ticks * TCO_TICK_NSEC * 2); 266 266 ad = get_watchdog_action(); 267 267 g_assert(!strcmp(qdict_get_str(ad, "action"), "pause")); 268 - QDECREF(ad); 268 + qobject_unref(ad); 269 269 270 270 stop_tco(&td); 271 271 test_end(&td); ··· 290 290 clock_step(ticks * TCO_TICK_NSEC * 2); 291 291 ad = get_watchdog_action(); 292 292 g_assert(!strcmp(qdict_get_str(ad, "action"), "reset")); 293 - QDECREF(ad); 293 + qobject_unref(ad); 294 294 295 295 stop_tco(&td); 296 296 test_end(&td); ··· 315 315 clock_step(ticks * TCO_TICK_NSEC * 2); 316 316 ad = get_watchdog_action(); 317 317 g_assert(!strcmp(qdict_get_str(ad, "action"), "shutdown")); 318 - QDECREF(ad); 318 + qobject_unref(ad); 319 319 320 320 stop_tco(&td); 321 321 test_end(&td); ··· 340 340 clock_step(ticks * TCO_TICK_NSEC * 2); 341 341 ad = get_watchdog_action(); 342 342 g_assert(!strcmp(qdict_get_str(ad, "action"), "none")); 343 - QDECREF(ad); 343 + qobject_unref(ad); 344 344 345 345 stop_tco(&td); 346 346 test_end(&td);
+1 -1
tests/test-char.c
··· 322 322 qdict = qobject_to(QDict, addr); 323 323 port = qdict_get_str(qdict, "port"); 324 324 tmp = g_strdup_printf("tcp:127.0.0.1:%s", port); 325 - QDECREF(qdict); 325 + qobject_unref(qdict); 326 326 327 327 qemu_chr_fe_init(&be, chr, &error_abort); 328 328 qemu_chr_fe_set_handlers(&be, socket_can_read, socket_read,
+41 -41
tests/test-keyval.c
··· 30 30 /* Nothing */ 31 31 qdict = keyval_parse("", NULL, &error_abort); 32 32 g_assert_cmpuint(qdict_size(qdict), ==, 0); 33 - QDECREF(qdict); 33 + qobject_unref(qdict); 34 34 35 35 /* Empty key (qemu_opts_parse() accepts this) */ 36 36 qdict = keyval_parse("=val", NULL, &err); ··· 70 70 qdict = keyval_parse(params + 2, NULL, &error_abort); 71 71 g_assert_cmpuint(qdict_size(qdict), ==, 1); 72 72 g_assert_cmpstr(qdict_get_try_str(qdict, long_key + 1), ==, "v"); 73 - QDECREF(qdict); 73 + qobject_unref(qdict); 74 74 75 75 /* Long key fragment */ 76 76 qdict = keyval_parse(params, NULL, &error_abort); ··· 79 79 g_assert(sub_qdict); 80 80 g_assert_cmpuint(qdict_size(sub_qdict), ==, 1); 81 81 g_assert_cmpstr(qdict_get_try_str(sub_qdict, long_key + 1), ==, "v"); 82 - QDECREF(qdict); 82 + qobject_unref(qdict); 83 83 g_free(params); 84 84 85 85 /* Crap after valid key */ ··· 92 92 g_assert_cmpuint(qdict_size(qdict), ==, 2); 93 93 g_assert_cmpstr(qdict_get_try_str(qdict, "a"), ==, "3"); 94 94 g_assert_cmpstr(qdict_get_try_str(qdict, "b"), ==, "2,x"); 95 - QDECREF(qdict); 95 + qobject_unref(qdict); 96 96 97 97 /* Even when it doesn't in qemu_opts_parse() */ 98 98 qdict = keyval_parse("id=foo,id=bar", NULL, &error_abort); 99 99 g_assert_cmpuint(qdict_size(qdict), ==, 1); 100 100 g_assert_cmpstr(qdict_get_try_str(qdict, "id"), ==, "bar"); 101 - QDECREF(qdict); 101 + qobject_unref(qdict); 102 102 103 103 /* Dotted keys */ 104 104 qdict = keyval_parse("a.b.c=1,a.b.c=2,d=3", NULL, &error_abort); ··· 111 111 g_assert_cmpuint(qdict_size(sub_qdict), ==, 1); 112 112 g_assert_cmpstr(qdict_get_try_str(sub_qdict, "c"), ==, "2"); 113 113 g_assert_cmpstr(qdict_get_try_str(qdict, "d"), ==, "3"); 114 - QDECREF(qdict); 114 + qobject_unref(qdict); 115 115 116 116 /* Inconsistent dotted keys */ 117 117 qdict = keyval_parse("a.b=1,a=2", NULL, &err); ··· 125 125 qdict = keyval_parse("x=y,", NULL, &error_abort); 126 126 g_assert_cmpuint(qdict_size(qdict), ==, 1); 127 127 g_assert_cmpstr(qdict_get_try_str(qdict, "x"), ==, "y"); 128 - QDECREF(qdict); 128 + qobject_unref(qdict); 129 129 130 130 /* Except when it isn't */ 131 131 qdict = keyval_parse(",", NULL, &err); ··· 136 136 qdict = keyval_parse("x=,,id=bar", NULL, &error_abort); 137 137 g_assert_cmpuint(qdict_size(qdict), ==, 1); 138 138 g_assert_cmpstr(qdict_get_try_str(qdict, "x"), ==, ",id=bar"); 139 - QDECREF(qdict); 139 + qobject_unref(qdict); 140 140 141 141 /* Anti-social ID is left to caller (qemu_opts_parse() rejects it) */ 142 142 qdict = keyval_parse("id=666", NULL, &error_abort); 143 143 g_assert_cmpuint(qdict_size(qdict), ==, 1); 144 144 g_assert_cmpstr(qdict_get_try_str(qdict, "id"), ==, "666"); 145 - QDECREF(qdict); 145 + qobject_unref(qdict); 146 146 147 147 /* Implied value not supported (unlike qemu_opts_parse()) */ 148 148 qdict = keyval_parse("an,noaus,noaus=", NULL, &err); ··· 160 160 g_assert_cmpstr(qdict_get_try_str(qdict, "implied"), ==, "an"); 161 161 g_assert_cmpstr(qdict_get_try_str(qdict, "aus"), ==, "off"); 162 162 g_assert_cmpstr(qdict_get_try_str(qdict, "noaus"), ==, ""); 163 - QDECREF(qdict); 163 + qobject_unref(qdict); 164 164 165 165 /* Implied dotted key */ 166 166 qdict = keyval_parse("val", "eins.zwei", &error_abort); ··· 169 169 g_assert(sub_qdict); 170 170 g_assert_cmpuint(qdict_size(sub_qdict), ==, 1); 171 171 g_assert_cmpstr(qdict_get_try_str(sub_qdict, "zwei"), ==, "val"); 172 - QDECREF(qdict); 172 + qobject_unref(qdict); 173 173 174 174 /* Implied key with empty value (qemu_opts_parse() accepts this) */ 175 175 qdict = keyval_parse(",", "implied", &err); ··· 198 198 qstr = qobject_to(QString, qlist_pop(qlist)); 199 199 g_assert(qstr); 200 200 g_assert_cmpstr(qstring_get_str(qstr), ==, expected[i]); 201 - QDECREF(qstr); 201 + qobject_unref(qstr); 202 202 } 203 203 g_assert(qlist_empty(qlist)); 204 204 } ··· 218 218 NULL, &error_abort); 219 219 g_assert_cmpint(qdict_size(qdict), ==, 1); 220 220 check_list012(qdict_get_qlist(qdict, "list")); 221 - QDECREF(qdict); 221 + qobject_unref(qdict); 222 222 223 223 /* Multiple indexes, last one wins */ 224 224 qdict = keyval_parse("list.1=goner,list.0=null,list.01=eins,list.2=zwei", 225 225 NULL, &error_abort); 226 226 g_assert_cmpint(qdict_size(qdict), ==, 1); 227 227 check_list012(qdict_get_qlist(qdict, "list")); 228 - QDECREF(qdict); 228 + qobject_unref(qdict); 229 229 230 230 /* List at deeper nesting */ 231 231 qdict = keyval_parse("a.list.1=eins,a.list.00=null,a.list.2=zwei", ··· 234 234 sub_qdict = qdict_get_qdict(qdict, "a"); 235 235 g_assert_cmpint(qdict_size(sub_qdict), ==, 1); 236 236 check_list012(qdict_get_qlist(sub_qdict, "list")); 237 - QDECREF(qdict); 237 + qobject_unref(qdict); 238 238 239 239 /* Inconsistent dotted keys: both list and dictionary */ 240 240 qdict = keyval_parse("a.b.c=1,a.b.0=2", NULL, &err); ··· 262 262 263 263 qdict = keyval_parse("bool1=on,bool2=off", NULL, &error_abort); 264 264 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 265 - QDECREF(qdict); 265 + qobject_unref(qdict); 266 266 visit_start_struct(v, NULL, NULL, 0, &error_abort); 267 267 visit_type_bool(v, "bool1", &b, &error_abort); 268 268 g_assert(b); ··· 274 274 275 275 qdict = keyval_parse("bool1=offer", NULL, &error_abort); 276 276 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 277 - QDECREF(qdict); 277 + qobject_unref(qdict); 278 278 visit_start_struct(v, NULL, NULL, 0, &error_abort); 279 279 visit_type_bool(v, "bool1", &b, &err); 280 280 error_free_or_abort(&err); ··· 292 292 /* Lower limit zero */ 293 293 qdict = keyval_parse("number1=0", NULL, &error_abort); 294 294 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 295 - QDECREF(qdict); 295 + qobject_unref(qdict); 296 296 visit_start_struct(v, NULL, NULL, 0, &error_abort); 297 297 visit_type_uint64(v, "number1", &u, &error_abort); 298 298 g_assert_cmpuint(u, ==, 0); ··· 304 304 qdict = keyval_parse("number1=18446744073709551615,number2=-1", 305 305 NULL, &error_abort); 306 306 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 307 - QDECREF(qdict); 307 + qobject_unref(qdict); 308 308 visit_start_struct(v, NULL, NULL, 0, &error_abort); 309 309 visit_type_uint64(v, "number1", &u, &error_abort); 310 310 g_assert_cmphex(u, ==, UINT64_MAX); ··· 318 318 qdict = keyval_parse("number1=18446744073709551616", 319 319 NULL, &error_abort); 320 320 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 321 - QDECREF(qdict); 321 + qobject_unref(qdict); 322 322 visit_start_struct(v, NULL, NULL, 0, &error_abort); 323 323 visit_type_uint64(v, "number1", &u, &err); 324 324 error_free_or_abort(&err); ··· 329 329 qdict = keyval_parse("number1=-18446744073709551616", 330 330 NULL, &error_abort); 331 331 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 332 - QDECREF(qdict); 332 + qobject_unref(qdict); 333 333 visit_start_struct(v, NULL, NULL, 0, &error_abort); 334 334 visit_type_uint64(v, "number1", &u, &err); 335 335 error_free_or_abort(&err); ··· 340 340 qdict = keyval_parse("number1=0x2a,number2=052", 341 341 NULL, &error_abort); 342 342 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 343 - QDECREF(qdict); 343 + qobject_unref(qdict); 344 344 visit_start_struct(v, NULL, NULL, 0, &error_abort); 345 345 visit_type_uint64(v, "number1", &u, &error_abort); 346 346 g_assert_cmpuint(u, ==, 42); ··· 354 354 qdict = keyval_parse("number1=3.14,number2=08", 355 355 NULL, &error_abort); 356 356 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 357 - QDECREF(qdict); 357 + qobject_unref(qdict); 358 358 visit_start_struct(v, NULL, NULL, 0, &error_abort); 359 359 visit_type_uint64(v, "number1", &u, &err); 360 360 error_free_or_abort(&err); ··· 374 374 /* Lower limit zero */ 375 375 qdict = keyval_parse("sz1=0", NULL, &error_abort); 376 376 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 377 - QDECREF(qdict); 377 + qobject_unref(qdict); 378 378 visit_start_struct(v, NULL, NULL, 0, &error_abort); 379 379 visit_type_size(v, "sz1", &sz, &error_abort); 380 380 g_assert_cmpuint(sz, ==, 0); ··· 390 390 "sz3=9007199254740993", 391 391 NULL, &error_abort); 392 392 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 393 - QDECREF(qdict); 393 + qobject_unref(qdict); 394 394 visit_start_struct(v, NULL, NULL, 0, &error_abort); 395 395 visit_type_size(v, "sz1", &sz, &error_abort); 396 396 g_assert_cmphex(sz, ==, 0x1fffffffffffff); ··· 407 407 "sz2=9223372036854775295", /* 7ffffffffffffdff */ 408 408 NULL, &error_abort); 409 409 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 410 - QDECREF(qdict); 410 + qobject_unref(qdict); 411 411 visit_start_struct(v, NULL, NULL, 0, &error_abort); 412 412 visit_type_size(v, "sz1", &sz, &error_abort); 413 413 g_assert_cmphex(sz, ==, 0x7ffffffffffffc00); ··· 422 422 "sz2=18446744073709550591", /* fffffffffffffbff */ 423 423 NULL, &error_abort); 424 424 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 425 - QDECREF(qdict); 425 + qobject_unref(qdict); 426 426 visit_start_struct(v, NULL, NULL, 0, &error_abort); 427 427 visit_type_size(v, "sz1", &sz, &error_abort); 428 428 g_assert_cmphex(sz, ==, 0xfffffffffffff800); ··· 437 437 "sz2=18446744073709550592", /* fffffffffffffc00 */ 438 438 NULL, &error_abort); 439 439 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 440 - QDECREF(qdict); 440 + qobject_unref(qdict); 441 441 visit_start_struct(v, NULL, NULL, 0, &error_abort); 442 442 visit_type_size(v, "sz1", &sz, &err); 443 443 error_free_or_abort(&err); ··· 450 450 qdict = keyval_parse("sz1=8b,sz2=1.5k,sz3=2M,sz4=0.1G,sz5=16777215T", 451 451 NULL, &error_abort); 452 452 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 453 - QDECREF(qdict); 453 + qobject_unref(qdict); 454 454 visit_start_struct(v, NULL, NULL, 0, &error_abort); 455 455 visit_type_size(v, "sz1", &sz, &error_abort); 456 456 g_assert_cmpuint(sz, ==, 8); ··· 469 469 /* Beyond limit with suffix */ 470 470 qdict = keyval_parse("sz1=16777216T", NULL, &error_abort); 471 471 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 472 - QDECREF(qdict); 472 + qobject_unref(qdict); 473 473 visit_start_struct(v, NULL, NULL, 0, &error_abort); 474 474 visit_type_size(v, "sz1", &sz, &err); 475 475 error_free_or_abort(&err); ··· 479 479 /* Trailing crap */ 480 480 qdict = keyval_parse("sz1=16E,sz2=16Gi", NULL, &error_abort); 481 481 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 482 - QDECREF(qdict); 482 + qobject_unref(qdict); 483 483 visit_start_struct(v, NULL, NULL, 0, &error_abort); 484 484 visit_type_size(v, "sz1", &sz, &err); 485 485 error_free_or_abort(&err); ··· 498 498 499 499 qdict = keyval_parse("a.b.c=1,a.b.c=2,d=3", NULL, &error_abort); 500 500 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 501 - QDECREF(qdict); 501 + qobject_unref(qdict); 502 502 visit_start_struct(v, NULL, NULL, 0, &error_abort); 503 503 visit_start_struct(v, "a", NULL, 0, &error_abort); 504 504 visit_start_struct(v, "b", NULL, 0, &error_abort); ··· 516 516 517 517 qdict = keyval_parse("a.b=", NULL, &error_abort); 518 518 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 519 - QDECREF(qdict); 519 + qobject_unref(qdict); 520 520 visit_start_struct(v, NULL, NULL, 0, &error_abort); 521 521 visit_start_struct(v, "a", NULL, 0, &error_abort); 522 522 visit_type_int(v, "c", &i, &err); /* a.c missing */ ··· 539 539 qdict = keyval_parse("a.0=,a.1=I,a.2.0=II", NULL, &error_abort); 540 540 /* TODO empty list */ 541 541 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 542 - QDECREF(qdict); 542 + qobject_unref(qdict); 543 543 visit_start_struct(v, NULL, NULL, 0, &error_abort); 544 544 visit_start_list(v, "a", NULL, 0, &error_abort); 545 545 visit_type_str(v, NULL, &s, &error_abort); ··· 562 562 563 563 qdict = keyval_parse("a.0=,b.0.0=head", NULL, &error_abort); 564 564 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 565 - QDECREF(qdict); 565 + qobject_unref(qdict); 566 566 visit_start_struct(v, NULL, NULL, 0, &error_abort); 567 567 visit_start_list(v, "a", NULL, 0, &error_abort); 568 568 visit_check_list(v, &err); /* a[0] unexpected */ ··· 591 591 592 592 qdict = keyval_parse("a.b=1", NULL, &error_abort); 593 593 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 594 - QDECREF(qdict); 594 + qobject_unref(qdict); 595 595 visit_start_struct(v, NULL, NULL, 0, &error_abort); 596 596 visit_optional(v, "b", &present); 597 597 g_assert(!present); /* b missing */ ··· 627 627 */ 628 628 qdict = keyval_parse("a=1,b=2,c=on", NULL, &error_abort); 629 629 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 630 - QDECREF(qdict); 630 + qobject_unref(qdict); 631 631 visit_start_struct(v, NULL, NULL, 0, &error_abort); 632 632 visit_type_AltStrObj(v, "a", &aso, &error_abort); 633 633 g_assert_cmpint(aso->type, ==, QTYPE_QSTRING); ··· 651 651 652 652 qdict = keyval_parse("a.0=null,a.1=1", NULL, &error_abort); 653 653 v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); 654 - QDECREF(qdict); 654 + qobject_unref(qdict); 655 655 visit_start_struct(v, NULL, NULL, 0, &error_abort); 656 656 visit_type_any(v, "a", &any, &error_abort); 657 657 qlist = qobject_to(QList, any); 658 658 g_assert(qlist); 659 659 qstr = qobject_to(QString, qlist_pop(qlist)); 660 660 g_assert_cmpstr(qstring_get_str(qstr), ==, "null"); 661 - QDECREF(qstr); 661 + qobject_unref(qstr); 662 662 qstr = qobject_to(QString, qlist_pop(qlist)); 663 663 g_assert_cmpstr(qstring_get_str(qstr), ==, "1"); 664 664 g_assert(qlist_empty(qlist)); 665 - QDECREF(qstr); 666 - qobject_decref(any); 665 + qobject_unref(qstr); 666 + qobject_unref(any); 667 667 visit_check_struct(v, &error_abort); 668 668 visit_end_struct(v, NULL); 669 669 visit_free(v);
+13 -13
tests/test-netfilter.c
··· 29 29 30 30 g_assert(response); 31 31 g_assert(!qdict_haskey(response, "error")); 32 - QDECREF(response); 32 + qobject_unref(response); 33 33 34 34 response = qmp("{'execute': 'object-del'," 35 35 " 'arguments': {" ··· 37 37 "}}"); 38 38 g_assert(response); 39 39 g_assert(!qdict_haskey(response, "error")); 40 - QDECREF(response); 40 + qobject_unref(response); 41 41 } 42 42 43 43 /* add a netfilter to a netdev and then remove the netdev */ ··· 57 57 58 58 g_assert(response); 59 59 g_assert(!qdict_haskey(response, "error")); 60 - QDECREF(response); 60 + qobject_unref(response); 61 61 62 62 response = qmp("{'execute': 'netdev_del'," 63 63 " 'arguments': {" ··· 65 65 "}}"); 66 66 g_assert(response); 67 67 g_assert(!qdict_haskey(response, "error")); 68 - QDECREF(response); 68 + qobject_unref(response); 69 69 70 70 /* add back the netdev */ 71 71 response = qmp("{'execute': 'netdev_add'," ··· 75 75 "}}"); 76 76 g_assert(response); 77 77 g_assert(!qdict_haskey(response, "error")); 78 - QDECREF(response); 78 + qobject_unref(response); 79 79 } 80 80 81 81 /* add multi(2) netfilters to a netdev and then remove them */ ··· 95 95 96 96 g_assert(response); 97 97 g_assert(!qdict_haskey(response, "error")); 98 - QDECREF(response); 98 + qobject_unref(response); 99 99 100 100 response = qmp("{'execute': 'object-add'," 101 101 " 'arguments': {" ··· 109 109 110 110 g_assert(response); 111 111 g_assert(!qdict_haskey(response, "error")); 112 - QDECREF(response); 112 + qobject_unref(response); 113 113 114 114 response = qmp("{'execute': 'object-del'," 115 115 " 'arguments': {" ··· 117 117 "}}"); 118 118 g_assert(response); 119 119 g_assert(!qdict_haskey(response, "error")); 120 - QDECREF(response); 120 + qobject_unref(response); 121 121 122 122 response = qmp("{'execute': 'object-del'," 123 123 " 'arguments': {" ··· 125 125 "}}"); 126 126 g_assert(response); 127 127 g_assert(!qdict_haskey(response, "error")); 128 - QDECREF(response); 128 + qobject_unref(response); 129 129 } 130 130 131 131 /* add multi(2) netfilters to a netdev and then remove the netdev */ ··· 145 145 146 146 g_assert(response); 147 147 g_assert(!qdict_haskey(response, "error")); 148 - QDECREF(response); 148 + qobject_unref(response); 149 149 150 150 response = qmp("{'execute': 'object-add'," 151 151 " 'arguments': {" ··· 159 159 160 160 g_assert(response); 161 161 g_assert(!qdict_haskey(response, "error")); 162 - QDECREF(response); 162 + qobject_unref(response); 163 163 164 164 response = qmp("{'execute': 'netdev_del'," 165 165 " 'arguments': {" ··· 167 167 "}}"); 168 168 g_assert(response); 169 169 g_assert(!qdict_haskey(response, "error")); 170 - QDECREF(response); 170 + qobject_unref(response); 171 171 172 172 /* add back the netdev */ 173 173 response = qmp("{'execute': 'netdev_add'," ··· 177 177 "}}"); 178 178 g_assert(response); 179 179 g_assert(!qdict_haskey(response, "error")); 180 - QDECREF(response); 180 + qobject_unref(response); 181 181 } 182 182 183 183 int main(int argc, char **argv)
+7 -7
tests/test-qemu-opts.c
··· 887 887 g_assert_cmpstr(qdict_get_str(dict, "number1"), ==, "42"); 888 888 g_assert_false(qdict_haskey(dict, "number2")); 889 889 890 - QDECREF(dict); 890 + qobject_unref(dict); 891 891 qemu_opts_del(opts); 892 892 } 893 893 ··· 914 914 g_assert_cmpstr(qdict_get_str(dict, "number1"), ==, "42"); 915 915 g_assert_false(qdict_haskey(dict, "number2")); 916 916 g_assert_false(qdict_haskey(dict, "bool1")); 917 - QDECREF(dict); 917 + qobject_unref(dict); 918 918 919 919 dict = qemu_opts_to_qdict_filtered(opts, NULL, &opts_list_02, false); 920 920 g_assert(dict != NULL); ··· 924 924 g_assert_false(qdict_haskey(dict, "str3")); 925 925 g_assert_false(qdict_haskey(dict, "number1")); 926 926 g_assert_false(qdict_haskey(dict, "number2")); 927 - QDECREF(dict); 927 + qobject_unref(dict); 928 928 929 929 /* Now delete converted options from opts */ 930 930 dict = qemu_opts_to_qdict_filtered(opts, NULL, &opts_list_01, true); ··· 935 935 g_assert_cmpstr(qdict_get_str(dict, "number1"), ==, "42"); 936 936 g_assert_false(qdict_haskey(dict, "number2")); 937 937 g_assert_false(qdict_haskey(dict, "bool1")); 938 - QDECREF(dict); 938 + qobject_unref(dict); 939 939 940 940 dict = qemu_opts_to_qdict_filtered(opts, NULL, &opts_list_02, true); 941 941 g_assert(dict != NULL); ··· 945 945 g_assert_false(qdict_haskey(dict, "str3")); 946 946 g_assert_false(qdict_haskey(dict, "number1")); 947 947 g_assert_false(qdict_haskey(dict, "number2")); 948 - QDECREF(dict); 948 + qobject_unref(dict); 949 949 950 950 g_assert_true(QTAILQ_EMPTY(&opts->head)); 951 951 ··· 978 978 dict = qemu_opts_to_qdict(opts, NULL); 979 979 g_assert(dict != NULL); 980 980 g_assert_cmpstr(qdict_get_str(dict, "foo"), ==, "b"); 981 - QDECREF(dict); 981 + qobject_unref(dict); 982 982 983 983 /* The last one still wins if entries are deleted, and both are deleted */ 984 984 dict = qemu_opts_to_qdict_filtered(opts, NULL, NULL, true); 985 985 g_assert(dict != NULL); 986 986 g_assert_cmpstr(qdict_get_str(dict, "foo"), ==, "b"); 987 - QDECREF(dict); 987 + qobject_unref(dict); 988 988 989 989 g_assert_true(QTAILQ_EMPTY(&opts->head)); 990 990
+38 -38
tests/test-qga.c
··· 180 180 v = qdict_get_int(ret, "return"); 181 181 g_assert_cmpint(r, ==, v); 182 182 183 - QDECREF(ret); 183 + qobject_unref(ret); 184 184 } 185 185 186 186 static void test_qga_sync(gconstpointer fix) ··· 212 212 v = qdict_get_int(ret, "return"); 213 213 g_assert_cmpint(r, ==, v); 214 214 215 - QDECREF(ret); 215 + qobject_unref(ret); 216 216 } 217 217 218 218 static void test_qga_ping(gconstpointer fix) ··· 224 224 g_assert_nonnull(ret); 225 225 qmp_assert_no_error(ret); 226 226 227 - QDECREF(ret); 227 + qobject_unref(ret); 228 228 } 229 229 230 230 static void test_qga_invalid_args(gconstpointer fix) ··· 244 244 g_assert_cmpstr(class, ==, "GenericError"); 245 245 g_assert_cmpstr(desc, ==, "Parameter 'foo' is unexpected"); 246 246 247 - QDECREF(ret); 247 + qobject_unref(ret); 248 248 } 249 249 250 250 static void test_qga_invalid_cmd(gconstpointer fix) ··· 263 263 g_assert_cmpstr(class, ==, "CommandNotFound"); 264 264 g_assert_cmpint(strlen(desc), >, 0); 265 265 266 - QDECREF(ret); 266 + qobject_unref(ret); 267 267 } 268 268 269 269 static void test_qga_info(gconstpointer fix) ··· 280 280 version = qdict_get_try_str(val, "version"); 281 281 g_assert_cmpstr(version, ==, QEMU_VERSION); 282 282 283 - QDECREF(ret); 283 + qobject_unref(ret); 284 284 } 285 285 286 286 static void test_qga_get_vcpus(gconstpointer fix) ··· 300 300 g_assert(qdict_haskey(qobject_to(QDict, entry->value), "online")); 301 301 g_assert(qdict_haskey(qobject_to(QDict, entry->value), "logical-id")); 302 302 303 - QDECREF(ret); 303 + qobject_unref(ret); 304 304 } 305 305 306 306 static void test_qga_get_fsinfo(gconstpointer fix) ··· 324 324 g_assert(qdict_haskey(qobject_to(QDict, entry->value), "disk")); 325 325 } 326 326 327 - QDECREF(ret); 327 + qobject_unref(ret); 328 328 } 329 329 330 330 static void test_qga_get_memory_block_info(gconstpointer fix) ··· 344 344 g_assert_cmpint(size, >, 0); 345 345 } 346 346 347 - QDECREF(ret); 347 + qobject_unref(ret); 348 348 } 349 349 350 350 static void test_qga_get_memory_blocks(gconstpointer fix) ··· 369 369 } 370 370 } 371 371 372 - QDECREF(ret); 372 + qobject_unref(ret); 373 373 } 374 374 375 375 static void test_qga_network_get_interfaces(gconstpointer fix) ··· 388 388 entry = qlist_first(list); 389 389 g_assert(qdict_haskey(qobject_to(QDict, entry->value), "name")); 390 390 391 - QDECREF(ret); 391 + qobject_unref(ret); 392 392 } 393 393 394 394 static void test_qga_file_ops(gconstpointer fix) ··· 410 410 g_assert_nonnull(ret); 411 411 qmp_assert_no_error(ret); 412 412 id = qdict_get_int(ret, "return"); 413 - QDECREF(ret); 413 + qobject_unref(ret); 414 414 415 415 enc = g_base64_encode(helloworld, sizeof(helloworld)); 416 416 /* write */ ··· 426 426 eof = qdict_get_bool(val, "eof"); 427 427 g_assert_cmpint(count, ==, sizeof(helloworld)); 428 428 g_assert_cmpint(eof, ==, 0); 429 - QDECREF(ret); 429 + qobject_unref(ret); 430 430 g_free(cmd); 431 431 432 432 /* flush */ ··· 434 434 " 'arguments': {'handle': %" PRId64 "} }", 435 435 id); 436 436 ret = qmp_fd(fixture->fd, cmd); 437 - QDECREF(ret); 437 + qobject_unref(ret); 438 438 g_free(cmd); 439 439 440 440 /* close */ ··· 442 442 " 'arguments': {'handle': %" PRId64 "} }", 443 443 id); 444 444 ret = qmp_fd(fixture->fd, cmd); 445 - QDECREF(ret); 445 + qobject_unref(ret); 446 446 g_free(cmd); 447 447 448 448 /* check content */ ··· 462 462 g_assert_nonnull(ret); 463 463 qmp_assert_no_error(ret); 464 464 id = qdict_get_int(ret, "return"); 465 - QDECREF(ret); 465 + qobject_unref(ret); 466 466 467 467 /* read */ 468 468 cmd = g_strdup_printf("{'execute': 'guest-file-read'," ··· 477 477 g_assert(eof); 478 478 g_assert_cmpstr(b64, ==, enc); 479 479 480 - QDECREF(ret); 480 + qobject_unref(ret); 481 481 g_free(cmd); 482 482 g_free(enc); 483 483 ··· 493 493 g_assert_cmpint(count, ==, 0); 494 494 g_assert(eof); 495 495 g_assert_cmpstr(b64, ==, ""); 496 - QDECREF(ret); 496 + qobject_unref(ret); 497 497 g_free(cmd); 498 498 499 499 /* seek */ ··· 508 508 eof = qdict_get_bool(val, "eof"); 509 509 g_assert_cmpint(count, ==, 6); 510 510 g_assert(!eof); 511 - QDECREF(ret); 511 + qobject_unref(ret); 512 512 g_free(cmd); 513 513 514 514 /* partial read */ ··· 527 527 g_assert_cmpmem(dec, count, helloworld + 6, sizeof(helloworld) - 6); 528 528 g_free(dec); 529 529 530 - QDECREF(ret); 530 + qobject_unref(ret); 531 531 g_free(cmd); 532 532 533 533 /* close */ ··· 535 535 " 'arguments': {'handle': %" PRId64 "} }", 536 536 id); 537 537 ret = qmp_fd(fixture->fd, cmd); 538 - QDECREF(ret); 538 + qobject_unref(ret); 539 539 g_free(cmd); 540 540 } 541 541 ··· 555 555 g_assert_nonnull(ret); 556 556 qmp_assert_no_error(ret); 557 557 id = qdict_get_int(ret, "return"); 558 - QDECREF(ret); 558 + qobject_unref(ret); 559 559 560 560 enc = g_base64_encode(helloworld, sizeof(helloworld)); 561 561 /* write */ ··· 571 571 eof = qdict_get_bool(val, "eof"); 572 572 g_assert_cmpint(count, ==, sizeof(helloworld)); 573 573 g_assert_cmpint(eof, ==, 0); 574 - QDECREF(ret); 574 + qobject_unref(ret); 575 575 g_free(cmd); 576 576 577 577 /* read (check implicit flush) */ ··· 586 586 g_assert_cmpint(count, ==, 0); 587 587 g_assert(eof); 588 588 g_assert_cmpstr(b64, ==, ""); 589 - QDECREF(ret); 589 + qobject_unref(ret); 590 590 g_free(cmd); 591 591 592 592 /* seek to 0 */ ··· 601 601 eof = qdict_get_bool(val, "eof"); 602 602 g_assert_cmpint(count, ==, 0); 603 603 g_assert(!eof); 604 - QDECREF(ret); 604 + qobject_unref(ret); 605 605 g_free(cmd); 606 606 607 607 /* read */ ··· 616 616 g_assert_cmpint(count, ==, sizeof(helloworld)); 617 617 g_assert(eof); 618 618 g_assert_cmpstr(b64, ==, enc); 619 - QDECREF(ret); 619 + qobject_unref(ret); 620 620 g_free(cmd); 621 621 g_free(enc); 622 622 ··· 625 625 " 'arguments': {'handle': %" PRId64 "} }", 626 626 id); 627 627 ret = qmp_fd(fixture->fd, cmd); 628 - QDECREF(ret); 628 + qobject_unref(ret); 629 629 g_free(cmd); 630 630 } 631 631 ··· 642 642 time = qdict_get_int(ret, "return"); 643 643 g_assert_cmpint(time, >, 0); 644 644 645 - QDECREF(ret); 645 + qobject_unref(ret); 646 646 } 647 647 648 648 static void test_qga_blacklist(gconstpointer data) ··· 661 661 desc = qdict_get_try_str(error, "desc"); 662 662 g_assert_cmpstr(class, ==, "GenericError"); 663 663 g_assert_nonnull(g_strstr_len(desc, -1, "has been disabled")); 664 - QDECREF(ret); 664 + qobject_unref(ret); 665 665 666 666 ret = qmp_fd(fix.fd, "{'execute': 'guest-get-time'}"); 667 667 g_assert_nonnull(ret); ··· 670 670 desc = qdict_get_try_str(error, "desc"); 671 671 g_assert_cmpstr(class, ==, "GenericError"); 672 672 g_assert_nonnull(g_strstr_len(desc, -1, "has been disabled")); 673 - QDECREF(ret); 673 + qobject_unref(ret); 674 674 675 675 /* check something work */ 676 676 ret = qmp_fd(fix.fd, "{'execute': 'guest-get-fsinfo'}"); 677 677 qmp_assert_no_error(ret); 678 - QDECREF(ret); 678 + qobject_unref(ret); 679 679 680 680 fixture_tear_down(&fix, NULL); 681 681 } ··· 772 772 status = qdict_get_try_str(ret, "return"); 773 773 g_assert_cmpstr(status, ==, "thawed"); 774 774 775 - QDECREF(ret); 775 + qobject_unref(ret); 776 776 } 777 777 778 778 static void test_qga_guest_exec(gconstpointer fix) ··· 795 795 val = qdict_get_qdict(ret, "return"); 796 796 pid = qdict_get_int(val, "pid"); 797 797 g_assert_cmpint(pid, >, 0); 798 - QDECREF(ret); 798 + qobject_unref(ret); 799 799 800 800 /* wait for completion */ 801 801 now = g_get_monotonic_time(); ··· 807 807 val = qdict_get_qdict(ret, "return"); 808 808 exited = qdict_get_bool(val, "exited"); 809 809 if (!exited) { 810 - QDECREF(ret); 810 + qobject_unref(ret); 811 811 } 812 812 } while (!exited && 813 813 g_get_monotonic_time() < now + 5 * G_TIME_SPAN_SECOND); ··· 822 822 g_assert_cmpint(len, ==, 12); 823 823 g_assert_cmpstr((char *)decoded, ==, "\" test_str \""); 824 824 g_free(decoded); 825 - QDECREF(ret); 825 + qobject_unref(ret); 826 826 } 827 827 828 828 static void test_qga_guest_exec_invalid(gconstpointer fix) ··· 841 841 desc = qdict_get_str(error, "desc"); 842 842 g_assert_cmpstr(class, ==, "GenericError"); 843 843 g_assert_cmpint(strlen(desc), >, 0); 844 - QDECREF(ret); 844 + qobject_unref(ret); 845 845 846 846 /* invalid pid */ 847 847 ret = qmp_fd(fixture->fd, "{'execute': 'guest-exec-status'," ··· 853 853 desc = qdict_get_str(error, "desc"); 854 854 g_assert_cmpstr(class, ==, "GenericError"); 855 855 g_assert_cmpint(strlen(desc), >, 0); 856 - QDECREF(ret); 856 + qobject_unref(ret); 857 857 } 858 858 859 859 static void test_qga_guest_get_osinfo(gconstpointer data) ··· 905 905 g_assert_nonnull(str); 906 906 g_assert_cmpstr(str, ==, "unit-test"); 907 907 908 - QDECREF(ret); 908 + qobject_unref(ret); 909 909 g_free(env[0]); 910 910 fixture_tear_down(&fixture, NULL); 911 911 }
+12 -12
tests/test-qmp-cmds.c
··· 106 106 assert(resp != NULL); 107 107 assert(!qdict_haskey(qobject_to(QDict, resp), "error")); 108 108 109 - qobject_decref(resp); 110 - QDECREF(req); 109 + qobject_unref(resp); 110 + qobject_unref(req); 111 111 } 112 112 113 113 /* test commands that return an error due to invalid parameters */ ··· 123 123 assert(resp != NULL); 124 124 assert(qdict_haskey(qobject_to(QDict, resp), "error")); 125 125 126 - qobject_decref(resp); 127 - QDECREF(req); 126 + qobject_unref(resp); 127 + qobject_unref(req); 128 128 129 129 /* check that with extra arguments it throws an error */ 130 130 req = qdict_new(); ··· 137 137 assert(resp != NULL); 138 138 assert(qdict_haskey(qobject_to(QDict, resp), "error")); 139 139 140 - qobject_decref(resp); 141 - QDECREF(req); 140 + qobject_unref(resp); 141 + qobject_unref(req); 142 142 } 143 143 144 144 static QObject *test_qmp_dispatch(QDict *req) ··· 153 153 assert(resp && !qdict_haskey(resp, "error")); 154 154 ret = qdict_get(resp, "return"); 155 155 assert(ret); 156 - qobject_incref(ret); 157 - qobject_decref(resp_obj); 156 + qobject_ref(ret); 157 + qobject_unref(resp_obj); 158 158 return ret; 159 159 } 160 160 ··· 195 195 assert(qdict_get_int(ret_dict_dict2_userdef, "integer") == 422); 196 196 assert(!strcmp(qdict_get_str(ret_dict_dict2_userdef, "string"), "hello2")); 197 197 assert(!strcmp(qdict_get_str(ret_dict_dict2, "string"), "blah4")); 198 - QDECREF(ret); 198 + qobject_unref(ret); 199 199 200 200 qdict_put_int(args3, "a", 66); 201 201 qdict_put(req, "arguments", args3); ··· 204 204 ret3 = qobject_to(QNum, test_qmp_dispatch(req)); 205 205 g_assert(qnum_get_try_int(ret3, &val)); 206 206 g_assert_cmpint(val, ==, 66); 207 - QDECREF(ret3); 207 + qobject_unref(ret3); 208 208 209 - QDECREF(req); 209 + qobject_unref(req); 210 210 } 211 211 212 212 /* test generated dealloc functions for generated types */ ··· 257 257 v = qobject_input_visitor_new(QOBJECT(ud2_dict)); 258 258 visit_type_UserDefTwo(v, NULL, &ud2, &err); 259 259 visit_free(v); 260 - QDECREF(ud2_dict); 260 + qobject_unref(ud2_dict); 261 261 } 262 262 263 263 /* verify that visit_type_XXX() cleans up properly on error */
+1 -1
tests/test-qmp-event.c
··· 133 133 static void event_teardown(TestEventData *data, 134 134 const void *unused) 135 135 { 136 - QDECREF(data->expect); 136 + qobject_unref(data->expect); 137 137 test_event_data = NULL; 138 138 139 139 g_mutex_unlock(&test_event_lock);
+5 -5
tests/test-qobject-input-visitor.c
··· 35 35 static void visitor_input_teardown(TestInputVisitorData *data, 36 36 const void *unused) 37 37 { 38 - qobject_decref(data->obj); 38 + qobject_unref(data->obj); 39 39 data->obj = NULL; 40 40 41 41 if (data->qiv) { ··· 483 483 g_assert(qnum); 484 484 g_assert(qnum_get_try_int(qnum, &val)); 485 485 g_assert_cmpint(val, ==, -42); 486 - qobject_decref(res); 486 + qobject_unref(res); 487 487 488 488 v = visitor_input_test_init(data, "{ 'integer': -42, 'boolean': true, 'string': 'foo' }"); 489 489 visit_type_any(v, NULL, &res, &error_abort); ··· 505 505 qstring = qobject_to(QString, qobj); 506 506 g_assert(qstring); 507 507 g_assert_cmpstr(qstring_get_str(qstring), ==, "foo"); 508 - qobject_decref(res); 508 + qobject_unref(res); 509 509 } 510 510 511 511 static void test_visitor_in_null(TestInputVisitorData *data, ··· 530 530 visit_start_struct(v, NULL, NULL, 0, &error_abort); 531 531 visit_type_null(v, "a", &null, &error_abort); 532 532 g_assert(qobject_type(QOBJECT(null)) == QTYPE_QNULL); 533 - QDECREF(null); 533 + qobject_unref(null); 534 534 visit_type_null(v, "b", &null, &err); 535 535 error_free_or_abort(&err); 536 536 g_assert(!null); ··· 1262 1262 g_assert(schema); 1263 1263 1264 1264 qapi_free_SchemaInfoList(schema); 1265 - qobject_decref(obj); 1265 + qobject_unref(obj); 1266 1266 visit_free(v); 1267 1267 } 1268 1268
+9 -9
tests/test-qobject-output-visitor.c
··· 40 40 { 41 41 visit_free(data->ov); 42 42 data->ov = NULL; 43 - qobject_decref(data->obj); 43 + qobject_unref(data->obj); 44 44 data->obj = NULL; 45 45 } 46 46 ··· 346 346 g_assert(qnum); 347 347 g_assert(qnum_get_try_int(qnum, &val)); 348 348 g_assert_cmpint(val, ==, -42); 349 - qobject_decref(qobj); 349 + qobject_unref(qobj); 350 350 351 351 visitor_reset(data); 352 352 qdict = qdict_new(); ··· 355 355 qdict_put_str(qdict, "string", "foo"); 356 356 qobj = QOBJECT(qdict); 357 357 visit_type_any(data->ov, NULL, &qobj, &error_abort); 358 - qobject_decref(qobj); 358 + qobject_unref(qobj); 359 359 qdict = qobject_to(QDict, visitor_get(data)); 360 360 g_assert(qdict); 361 361 qnum = qobject_to(QNum, qdict_get(qdict, "integer")); ··· 630 630 qvalue = qobject_to(QNum, tmp); 631 631 g_assert(qnum_get_try_uint(qvalue, &val)); 632 632 g_assert_cmpint(val, ==, i); 633 - qobject_decref(qlist_pop(qlist)); 633 + qobject_unref(qlist_pop(qlist)); 634 634 } 635 635 break; 636 636 ··· 654 654 qvalue = qobject_to(QNum, tmp); 655 655 g_assert(qnum_get_try_int(qvalue, &val)); 656 656 g_assert_cmpint(val, ==, i); 657 - qobject_decref(qlist_pop(qlist)); 657 + qobject_unref(qlist_pop(qlist)); 658 658 } 659 659 break; 660 660 case USER_DEF_NATIVE_LIST_UNION_KIND_BOOLEAN: ··· 665 665 g_assert(tmp); 666 666 qvalue = qobject_to(QBool, tmp); 667 667 g_assert_cmpint(qbool_get_bool(qvalue), ==, i % 3 == 0); 668 - qobject_decref(qlist_pop(qlist)); 668 + qobject_unref(qlist_pop(qlist)); 669 669 } 670 670 break; 671 671 case USER_DEF_NATIVE_LIST_UNION_KIND_STRING: ··· 678 678 qvalue = qobject_to(QString, tmp); 679 679 sprintf(str, "%d", i); 680 680 g_assert_cmpstr(qstring_get_str(qvalue), ==, str); 681 - qobject_decref(qlist_pop(qlist)); 681 + qobject_unref(qlist_pop(qlist)); 682 682 } 683 683 break; 684 684 case USER_DEF_NATIVE_LIST_UNION_KIND_NUMBER: ··· 695 695 g_string_printf(double_actual, "%.6f", qnum_get_double(qvalue)); 696 696 g_assert_cmpstr(double_actual->str, ==, double_expected->str); 697 697 698 - qobject_decref(qlist_pop(qlist)); 698 + qobject_unref(qlist_pop(qlist)); 699 699 g_string_free(double_expected, true); 700 700 g_string_free(double_actual, true); 701 701 } ··· 703 703 default: 704 704 g_assert_not_reached(); 705 705 } 706 - QDECREF(qlist); 706 + qobject_unref(qlist); 707 707 } 708 708 709 709 static void test_native_list(TestOutputVisitorData *data,
+3 -3
tests/test-visitor-serialization.c
··· 1036 1036 output_json = qobject_to_json(obj_orig); 1037 1037 obj = qobject_from_json(qstring_get_str(output_json), &error_abort); 1038 1038 1039 - QDECREF(output_json); 1039 + qobject_unref(output_json); 1040 1040 d->qiv = qobject_input_visitor_new(obj); 1041 - qobject_decref(obj_orig); 1042 - qobject_decref(obj); 1041 + qobject_unref(obj_orig); 1042 + qobject_unref(obj); 1043 1043 visit(d->qiv, native_out, errp); 1044 1044 } 1045 1045
+7 -7
tests/test-x86-cpuid-compat.c
··· 19 19 20 20 cpu0 = qobject_to(QDict, qlist_peek(ret)); 21 21 path = g_strdup(qdict_get_str(cpu0, "qom_path")); 22 - QDECREF(resp); 22 + qobject_unref(resp); 23 23 return path; 24 24 } 25 25 ··· 30 30 " 'property': %s } }", 31 31 path, prop); 32 32 QObject *ret = qdict_get(resp, "return"); 33 - qobject_incref(ret); 34 - QDECREF(resp); 33 + qobject_ref(ret); 34 + qobject_unref(resp); 35 35 return ret; 36 36 } 37 37 ··· 41 41 QBool *value = qobject_to(QBool, qom_get(path, prop)); 42 42 bool b = qbool_get_bool(value); 43 43 44 - QDECREF(value); 44 + qobject_unref(value); 45 45 return b; 46 46 } 47 47 #endif ··· 66 66 g_assert_cmpint(val, ==, args->expected_value); 67 67 qtest_end(); 68 68 69 - QDECREF(value); 69 + qobject_unref(value); 70 70 g_free(path); 71 71 } 72 72 ··· 142 142 143 143 g_assert(!!(value & (1U << args->bitnr)) == args->expected_value); 144 144 145 - QDECREF(present); 146 - QDECREF(filtered); 145 + qobject_unref(present); 146 + qobject_unref(filtered); 147 147 g_free(path); 148 148 } 149 149
+2 -2
tests/tmp105-test.c
··· 74 74 "'property': 'temperature' } }", id); 75 75 g_assert(qdict_haskey(response, "return")); 76 76 ret = qdict_get_int(response, "return"); 77 - QDECREF(response); 77 + qobject_unref(response); 78 78 return ret; 79 79 } 80 80 ··· 85 85 response = qmp("{ 'execute': 'qom-set', 'arguments': { 'path': %s, " 86 86 "'property': 'temperature', 'value': %d } }", id, value); 87 87 g_assert(qdict_haskey(response, "return")); 88 - QDECREF(response); 88 + qobject_unref(response); 89 89 } 90 90 91 91 #define TMP105_PRECISION (1000/16)
+3 -3
tests/vhost-user-test.c
··· 727 727 rsp = qmp("{ 'execute': 'migrate_set_speed'," 728 728 "'arguments': { 'value': 10 } }"); 729 729 g_assert(qdict_haskey(rsp, "return")); 730 - QDECREF(rsp); 730 + qobject_unref(rsp); 731 731 732 732 cmd = g_strdup_printf("{ 'execute': 'migrate'," 733 733 "'arguments': { 'uri': '%s' } }", ··· 735 735 rsp = qmp(cmd); 736 736 g_free(cmd); 737 737 g_assert(qdict_haskey(rsp, "return")); 738 - QDECREF(rsp); 738 + qobject_unref(rsp); 739 739 740 740 wait_for_log_fd(s); 741 741 ··· 751 751 rsp = qmp("{ 'execute': 'migrate_set_speed'," 752 752 "'arguments': { 'value': 0 } }"); 753 753 g_assert(qdict_haskey(rsp, "return")); 754 - QDECREF(rsp); 754 + qobject_unref(rsp); 755 755 756 756 qmp_eventwait("STOP"); 757 757
+3 -3
tests/virtio-net-test.c
··· 173 173 qvirtqueue_kick(dev, vq, free_head); 174 174 175 175 rsp = qmp("{ 'execute' : 'stop'}"); 176 - QDECREF(rsp); 176 + qobject_unref(rsp); 177 177 178 178 ret = iov_send(socket, iov, 2, 0, sizeof(len) + sizeof(test)); 179 179 g_assert_cmpint(ret, ==, sizeof(test) + sizeof(len)); ··· 182 182 * ensure the packet data gets queued in QEMU, before we do 'cont'. 183 183 */ 184 184 rsp = qmp("{ 'execute' : 'query-status'}"); 185 - QDECREF(rsp); 185 + qobject_unref(rsp); 186 186 rsp = qmp("{ 'execute' : 'cont'}"); 187 - QDECREF(rsp); 187 + qobject_unref(rsp); 188 188 189 189 qvirtio_wait_used_elem(dev, vq, free_head, NULL, QVIRTIO_NET_TIMEOUT_US); 190 190 memread(req_addr + VNET_HDR_SIZE, buffer, sizeof(test));
+1 -1
tests/vmgenid-test.c
··· 125 125 guid_str = qdict_get_str(rsp_ret, "guid"); 126 126 g_assert(qemu_uuid_parse(guid_str, guid) == 0); 127 127 } 128 - QDECREF(rsp); 128 + qobject_unref(rsp); 129 129 } 130 130 131 131 static char disk[] = "tests/vmgenid-test-disk-XXXXXX";
+7 -7
tests/wdt_ib700-test.c
··· 16 16 { 17 17 QDict *resp = qtest_qmp(s, "{'execute':'query-status'}"); 18 18 g_assert(qdict_haskey(resp, "return")); 19 - QDECREF(resp); 19 + qobject_unref(resp); 20 20 } 21 21 22 22 static QDict *ib700_program_and_wait(QTestState *s) ··· 48 48 qtest_clock_step(s, 2 * NANOSECONDS_PER_SECOND); 49 49 event = qtest_qmp_eventwait_ref(s, "WATCHDOG"); 50 50 data = qdict_get_qdict(event, "data"); 51 - QINCREF(data); 52 - QDECREF(event); 51 + qobject_ref(data); 52 + qobject_unref(event); 53 53 return data; 54 54 } 55 55 ··· 62 62 qtest_irq_intercept_in(s, "ioapic"); 63 63 d = ib700_program_and_wait(s); 64 64 g_assert(!strcmp(qdict_get_str(d, "action"), "pause")); 65 - QDECREF(d); 65 + qobject_unref(d); 66 66 qtest_qmp_eventwait(s, "STOP"); 67 67 qtest_quit(s); 68 68 } ··· 75 75 qtest_irq_intercept_in(s, "ioapic"); 76 76 d = ib700_program_and_wait(s); 77 77 g_assert(!strcmp(qdict_get_str(d, "action"), "reset")); 78 - QDECREF(d); 78 + qobject_unref(d); 79 79 qtest_qmp_eventwait(s, "RESET"); 80 80 qtest_quit(s); 81 81 } ··· 89 89 qtest_irq_intercept_in(s, "ioapic"); 90 90 d = ib700_program_and_wait(s); 91 91 g_assert(!strcmp(qdict_get_str(d, "action"), "reset")); 92 - QDECREF(d); 92 + qobject_unref(d); 93 93 qtest_qmp_eventwait(s, "SHUTDOWN"); 94 94 qtest_quit(s); 95 95 } ··· 102 102 qtest_irq_intercept_in(s, "ioapic"); 103 103 d = ib700_program_and_wait(s); 104 104 g_assert(!strcmp(qdict_get_str(d, "action"), "none")); 105 - QDECREF(d); 105 + qobject_unref(d); 106 106 qtest_quit(s); 107 107 } 108 108
+6 -6
util/keyval.c
··· 126 126 * Else, fail because we have conflicting needs on how to map 127 127 * @key_in_cur. 128 128 * In any case, take over the reference to @value, i.e. if the caller 129 - * wants to hold on to a reference, it needs to QINCREF(). 129 + * wants to hold on to a reference, it needs to qobject_ref(). 130 130 * Use @key up to @key_cursor to identify the key in error messages. 131 131 * On success, return the mapped value. 132 132 * On failure, store an error through @errp and return NULL. ··· 143 143 if (qobject_type(old) != (value ? QTYPE_QSTRING : QTYPE_QDICT)) { 144 144 error_setg(errp, "Parameters '%.*s.*' used inconsistently", 145 145 (int)(key_cursor - key), key); 146 - QDECREF(value); 146 + qobject_unref(value); 147 147 return NULL; 148 148 } 149 149 if (!value) { ··· 375 375 error_setg(errp, "Parameter '%s%d' missing", key, i); 376 376 g_free(key); 377 377 g_free(elt); 378 - QDECREF(list); 378 + qobject_unref(list); 379 379 return NULL; 380 380 } 381 - qobject_incref(elt[i]); 381 + qobject_ref(elt[i]); 382 382 qlist_append_obj(list, elt[i]); 383 383 } 384 384 ··· 404 404 while (*s) { 405 405 s = keyval_parse_one(qdict, s, implied_key, errp); 406 406 if (!s) { 407 - QDECREF(qdict); 407 + qobject_unref(qdict); 408 408 return NULL; 409 409 } 410 410 implied_key = NULL; ··· 412 412 413 413 listified = keyval_listify(qdict, NULL, errp); 414 414 if (!listified) { 415 - QDECREF(qdict); 415 + qobject_unref(qdict); 416 416 return NULL; 417 417 } 418 418 assert(listified == QOBJECT(qdict));
+2 -2
util/qemu-config.c
··· 562 562 } 563 563 564 564 out: 565 - QDECREF(subqdict); 566 - QDECREF(list); 565 + qobject_unref(subqdict); 566 + qobject_unref(list); 567 567 } 568 568 569 569 void qemu_config_parse_qdict(QDict *options, QemuOptsList **lists,