26ba25
From c01b425215024a64ae633ecfbc6c765bf87ad83e Mon Sep 17 00:00:00 2001
26ba25
From: Markus Armbruster <armbru@redhat.com>
26ba25
Date: Mon, 18 Jun 2018 08:43:11 +0200
26ba25
Subject: [PATCH 013/268] qobject: Replace qobject_incref/QINCREF
26ba25
 qobject_decref/QDECREF
26ba25
MIME-Version: 1.0
26ba25
Content-Type: text/plain; charset=UTF-8
26ba25
Content-Transfer-Encoding: 8bit
26ba25
26ba25
RH-Author: Markus Armbruster <armbru@redhat.com>
26ba25
Message-id: <20180618084330.30009-5-armbru@redhat.com>
26ba25
Patchwork-id: 80739
26ba25
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 04/23] qobject: Replace qobject_incref/QINCREF qobject_decref/QDECREF
26ba25
Bugzilla: 1557995
26ba25
RH-Acked-by: Max Reitz <mreitz@redhat.com>
26ba25
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
26ba25
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
26ba25
26ba25
From: Marc-André Lureau <marcandre.lureau@redhat.com>
26ba25
26ba25
Now that we can safely call QOBJECT() on QObject * as well as its
26ba25
subtypes, we can have macros qobject_ref() / qobject_unref() that work
26ba25
everywhere instead of having to use QINCREF() / QDECREF() for QObject
26ba25
and qobject_incref() / qobject_decref() for its subtypes.
26ba25
26ba25
The replacement is mechanical, except I broke a long line, and added a
26ba25
cast in monitor_qmp_cleanup_req_queue_locked().  Unlike
26ba25
qobject_decref(), qobject_unref() doesn't accept void *.
26ba25
26ba25
Note that the new macros evaluate their argument exactly once, thus no
26ba25
need to shout them.
26ba25
26ba25
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
26ba25
Reviewed-by: Eric Blake <eblake@redhat.com>
26ba25
Message-Id: <20180419150145.24795-4-marcandre.lureau@redhat.com>
26ba25
Reviewed-by: Markus Armbruster <armbru@redhat.com>
26ba25
[Rebased, semantic conflict resolved, commit message improved]
26ba25
Signed-off-by: Markus Armbruster <armbru@redhat.com>
26ba25
(cherry picked from commit cb3e7f08aeaab0ab13e629ce8496dca150a449ba)
26ba25
[Trivial conflict in tests/migration-test.c resolved]
26ba25
26ba25
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
26ba25
---
26ba25
 block.c                             |  78 ++++++++++++++--------------
26ba25
 block/blkdebug.c                    |   4 +-
26ba25
 block/blkverify.c                   |   4 +-
26ba25
 block/crypto.c                      |   4 +-
26ba25
 block/gluster.c                     |   4 +-
26ba25
 block/iscsi.c                       |   2 +-
26ba25
 block/nbd.c                         |   4 +-
26ba25
 block/nfs.c                         |   4 +-
26ba25
 block/null.c                        |   2 +-
26ba25
 block/nvme.c                        |   2 +-
26ba25
 block/parallels.c                   |   4 +-
26ba25
 block/qapi.c                        |   2 +-
26ba25
 block/qcow.c                        |   8 +--
26ba25
 block/qcow2.c                       |   8 +--
26ba25
 block/qed.c                         |   4 +-
26ba25
 block/quorum.c                      |   2 +-
26ba25
 block/rbd.c                         |  14 ++---
26ba25
 block/sheepdog.c                    |  12 ++---
26ba25
 block/snapshot.c                    |   4 +-
26ba25
 block/ssh.c                         |   4 +-
26ba25
 block/vdi.c                         |   2 +-
26ba25
 block/vhdx.c                        |   4 +-
26ba25
 block/vpc.c                         |   4 +-
26ba25
 block/vvfat.c                       |   2 +-
26ba25
 block/vxhs.c                        |   2 +-
26ba25
 blockdev.c                          |  16 +++---
26ba25
 docs/devel/qapi-code-gen.txt        |   2 +-
26ba25
 hw/i386/acpi-build.c                |  12 ++---
26ba25
 hw/ppc/spapr_drc.c                  |   2 +-
26ba25
 hw/usb/xen-usb.c                    |   4 +-
26ba25
 include/qapi/qmp/qnull.h            |   2 +-
26ba25
 include/qapi/qmp/qobject.h          |  40 +++++++--------
26ba25
 migration/migration.c               |   4 +-
26ba25
 migration/qjson.c                   |   2 +-
26ba25
 monitor.c                           |  50 +++++++++---------
26ba25
 qapi/qapi-dealloc-visitor.c         |   4 +-
26ba25
 qapi/qmp-dispatch.c                 |   6 +--
26ba25
 qapi/qobject-input-visitor.c        |   8 +--
26ba25
 qapi/qobject-output-visitor.c       |   8 +--
26ba25
 qemu-img.c                          |  18 +++----
26ba25
 qemu-io.c                           |   6 +--
26ba25
 qga/main.c                          |  12 ++---
26ba25
 qmp.c                               |   4 +-
26ba25
 qobject/json-parser.c               |  10 ++--
26ba25
 qobject/qdict.c                     |  38 +++++++-------
26ba25
 qobject/qjson.c                     |   2 +-
26ba25
 qobject/qlist.c                     |   4 +-
26ba25
 qom/object.c                        |  16 +++---
26ba25
 qom/object_interfaces.c             |   2 +-
26ba25
 scripts/coccinelle/qobject.cocci    |   8 +--
26ba25
 scripts/qapi/events.py              |   2 +-
26ba25
 target/ppc/translate_init.c         |   2 +-
26ba25
 target/s390x/cpu_models.c           |   2 +-
26ba25
 tests/ahci-test.c                   |   6 +--
26ba25
 tests/check-qdict.c                 | 100 ++++++++++++++++++------------------
26ba25
 tests/check-qjson.c                 |  84 +++++++++++++++---------------
26ba25
 tests/check-qlist.c                 |   8 +--
26ba25
 tests/check-qlit.c                  |  10 ++--
26ba25
 tests/check-qnull.c                 |  10 ++--
26ba25
 tests/check-qnum.c                  |  28 +++++-----
26ba25
 tests/check-qobject.c               |   2 +-
26ba25
 tests/check-qstring.c               |  10 ++--
26ba25
 tests/cpu-plug-test.c               |   4 +-
26ba25
 tests/device-introspect-test.c      |  24 ++++-----
26ba25
 tests/drive_del-test.c              |   4 +-
26ba25
 tests/libqos/libqos.c               |   8 +--
26ba25
 tests/libqos/pci-pc.c               |   2 +-
26ba25
 tests/libqtest.c                    |  24 ++++-----
26ba25
 tests/machine-none-test.c           |   2 +-
26ba25
 tests/migration-test.c              |  24 ++++-----
26ba25
 tests/numa-test.c                   |  16 +++---
26ba25
 tests/pvpanic-test.c                |   2 +-
26ba25
 tests/q35-test.c                    |   2 +-
26ba25
 tests/qmp-test.c                    |  38 +++++++-------
26ba25
 tests/qom-test.c                    |   8 +--
26ba25
 tests/tco-test.c                    |  12 ++---
26ba25
 tests/test-char.c                   |   2 +-
26ba25
 tests/test-keyval.c                 |  82 ++++++++++++++---------------
26ba25
 tests/test-netfilter.c              |  26 +++++-----
26ba25
 tests/test-qemu-opts.c              |  14 ++---
26ba25
 tests/test-qga.c                    |  76 +++++++++++++--------------
26ba25
 tests/test-qmp-cmds.c               |  24 ++++-----
26ba25
 tests/test-qmp-event.c              |   2 +-
26ba25
 tests/test-qobject-input-visitor.c  |  10 ++--
26ba25
 tests/test-qobject-output-visitor.c |  18 +++----
26ba25
 tests/test-visitor-serialization.c  |   6 +--
26ba25
 tests/test-x86-cpuid-compat.c       |  14 ++---
26ba25
 tests/tmp105-test.c                 |   4 +-
26ba25
 tests/vhost-user-test.c             |   6 +--
26ba25
 tests/virtio-net-test.c             |   6 +--
26ba25
 tests/vmgenid-test.c                |   2 +-
26ba25
 tests/wdt_ib700-test.c              |  14 ++---
26ba25
 util/keyval.c                       |  12 ++---
26ba25
 util/qemu-config.c                  |   4 +-
26ba25
 94 files changed, 608 insertions(+), 612 deletions(-)
26ba25
26ba25
diff --git a/block.c b/block.c
26ba25
index a2caadf..55a7984 100644
26ba25
--- a/block.c
26ba25
+++ b/block.c
26ba25
@@ -1227,9 +1227,9 @@ BlockDriverState *bdrv_new_open_driver(BlockDriver *drv, const char *node_name,
26ba25
 
26ba25
     ret = bdrv_open_driver(bs, drv, node_name, bs->options, flags, errp);
26ba25
     if (ret < 0) {
26ba25
-        QDECREF(bs->explicit_options);
26ba25
+        qobject_unref(bs->explicit_options);
26ba25
         bs->explicit_options = NULL;
26ba25
-        QDECREF(bs->options);
26ba25
+        qobject_unref(bs->options);
26ba25
         bs->options = NULL;
26ba25
         bdrv_unref(bs);
26ba25
         return NULL;
26ba25
@@ -1460,7 +1460,7 @@ static QDict *parse_json_filename(const char *filename, Error **errp)
26ba25
 
26ba25
     options = qobject_to(QDict, options_obj);
26ba25
     if (!options) {
26ba25
-        qobject_decref(options_obj);
26ba25
+        qobject_unref(options_obj);
26ba25
         error_setg(errp, "Invalid JSON object given");
26ba25
         return NULL;
26ba25
     }
26ba25
@@ -1490,7 +1490,7 @@ static void parse_json_protocol(QDict *options, const char **pfilename,
26ba25
     /* Options given in the filename have lower priority than options
26ba25
      * specified directly */
26ba25
     qdict_join(options, json_options, false);
26ba25
-    QDECREF(json_options);
26ba25
+    qobject_unref(json_options);
26ba25
     *pfilename = NULL;
26ba25
 }
26ba25
 
26ba25
@@ -2273,7 +2273,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
26ba25
     if (reference || qdict_haskey(options, "file.filename")) {
26ba25
         backing_filename[0] = '\0';
26ba25
     } else if (bs->backing_file[0] == '\0' && qdict_size(options) == 0) {
26ba25
-        QDECREF(options);
26ba25
+        qobject_unref(options);
26ba25
         goto free_exit;
26ba25
     } else {
26ba25
         bdrv_get_full_backing_filename(bs, backing_filename, PATH_MAX,
26ba25
@@ -2281,7 +2281,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
26ba25
         if (local_err) {
26ba25
             ret = -EINVAL;
26ba25
             error_propagate(errp, local_err);
26ba25
-            QDECREF(options);
26ba25
+            qobject_unref(options);
26ba25
             goto free_exit;
26ba25
         }
26ba25
     }
26ba25
@@ -2289,7 +2289,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
26ba25
     if (!bs->drv || !bs->drv->supports_backing) {
26ba25
         ret = -EINVAL;
26ba25
         error_setg(errp, "Driver doesn't support backing files");
26ba25
-        QDECREF(options);
26ba25
+        qobject_unref(options);
26ba25
         goto free_exit;
26ba25
     }
26ba25
 
26ba25
@@ -2323,7 +2323,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
26ba25
 
26ba25
 free_exit:
26ba25
     g_free(backing_filename);
26ba25
-    QDECREF(tmp_parent_options);
26ba25
+    qobject_unref(tmp_parent_options);
26ba25
     return ret;
26ba25
 }
26ba25
 
26ba25
@@ -2356,7 +2356,7 @@ bdrv_open_child_bs(const char *filename, QDict *options, const char *bdref_key,
26ba25
             error_setg(errp, "A block device must be specified for \"%s\"",
26ba25
                        bdref_key);
26ba25
         }
26ba25
-        QDECREF(image_options);
26ba25
+        qobject_unref(image_options);
26ba25
         goto done;
26ba25
     }
26ba25
 
26ba25
@@ -2449,7 +2449,7 @@ BlockDriverState *bdrv_open_blockdev_ref(BlockdevRef *ref, Error **errp)
26ba25
     obj = NULL;
26ba25
 
26ba25
 fail:
26ba25
-    qobject_decref(obj);
26ba25
+    qobject_unref(obj);
26ba25
     visit_free(v);
26ba25
     return bs;
26ba25
 }
26ba25
@@ -2519,7 +2519,7 @@ static BlockDriverState *bdrv_append_temp_snapshot(BlockDriverState *bs,
26ba25
     }
26ba25
 
26ba25
 out:
26ba25
-    QDECREF(snapshot_options);
26ba25
+    qobject_unref(snapshot_options);
26ba25
     g_free(tmp_filename);
26ba25
     return bs_snapshot;
26ba25
 }
26ba25
@@ -2530,7 +2530,7 @@ out:
26ba25
  * options is a QDict of options to pass to the block drivers, or NULL for an
26ba25
  * empty set of options. The reference to the QDict belongs to the block layer
26ba25
  * after the call (even on failure), so if the caller intends to reuse the
26ba25
- * dictionary, it needs to use QINCREF() before calling bdrv_open.
26ba25
+ * dictionary, it needs to use qobject_ref() before calling bdrv_open.
26ba25
  *
26ba25
  * If *pbs is NULL, a new BDS will be created with a pointer to it stored there.
26ba25
  * If it is not NULL, the referenced BDS will be reused.
26ba25
@@ -2561,7 +2561,7 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
26ba25
 
26ba25
     if (reference) {
26ba25
         bool options_non_empty = options ? qdict_size(options) : false;
26ba25
-        QDECREF(options);
26ba25
+        qobject_unref(options);
26ba25
 
26ba25
         if (filename || options_non_empty) {
26ba25
             error_setg(errp, "Cannot reference an existing block device with "
26ba25
@@ -2752,7 +2752,7 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
26ba25
 
26ba25
     bdrv_parent_cb_change_media(bs, true);
26ba25
 
26ba25
-    QDECREF(options);
26ba25
+    qobject_unref(options);
26ba25
 
26ba25
     /* For snapshot=on, create a temporary qcow2 overlay. bs points to the
26ba25
      * temporary snapshot afterwards. */
26ba25
@@ -2776,10 +2776,10 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
26ba25
 
26ba25
 fail:
26ba25
     blk_unref(file);
26ba25
-    QDECREF(snapshot_options);
26ba25
-    QDECREF(bs->explicit_options);
26ba25
-    QDECREF(bs->options);
26ba25
-    QDECREF(options);
26ba25
+    qobject_unref(snapshot_options);
26ba25
+    qobject_unref(bs->explicit_options);
26ba25
+    qobject_unref(bs->options);
26ba25
+    qobject_unref(options);
26ba25
     bs->options = NULL;
26ba25
     bs->explicit_options = NULL;
26ba25
     bdrv_unref(bs);
26ba25
@@ -2788,8 +2788,8 @@ fail:
26ba25
 
26ba25
 close_and_fail:
26ba25
     bdrv_unref(bs);
26ba25
-    QDECREF(snapshot_options);
26ba25
-    QDECREF(options);
26ba25
+    qobject_unref(snapshot_options);
26ba25
+    qobject_unref(options);
26ba25
     error_propagate(errp, local_err);
26ba25
     return NULL;
26ba25
 }
26ba25
@@ -2884,7 +2884,7 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
26ba25
         old_options = qdict_clone_shallow(bs->explicit_options);
26ba25
     }
26ba25
     bdrv_join_options(bs, options, old_options);
26ba25
-    QDECREF(old_options);
26ba25
+    qobject_unref(old_options);
26ba25
 
26ba25
     explicit_options = qdict_clone_shallow(options);
26ba25
 
26ba25
@@ -2899,13 +2899,13 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
26ba25
         qemu_opts_absorb_qdict(opts, options_copy, NULL);
26ba25
         update_flags_from_options(&flags, opts);
26ba25
         qemu_opts_del(opts);
26ba25
-        QDECREF(options_copy);
26ba25
+        qobject_unref(options_copy);
26ba25
     }
26ba25
 
26ba25
     /* Old values are used for options that aren't set yet */
26ba25
     old_options = qdict_clone_shallow(bs->options);
26ba25
     bdrv_join_options(bs, options, old_options);
26ba25
-    QDECREF(old_options);
26ba25
+    qobject_unref(old_options);
26ba25
 
26ba25
     /* bdrv_open_inherit() sets and clears some additional flags internally */
26ba25
     flags &= ~BDRV_O_PROTOCOL;
26ba25
@@ -2917,8 +2917,8 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
26ba25
         bs_entry = g_new0(BlockReopenQueueEntry, 1);
26ba25
         QSIMPLEQ_INSERT_TAIL(bs_queue, bs_entry, entry);
26ba25
     } else {
26ba25
-        QDECREF(bs_entry->state.options);
26ba25
-        QDECREF(bs_entry->state.explicit_options);
26ba25
+        qobject_unref(bs_entry->state.options);
26ba25
+        qobject_unref(bs_entry->state.explicit_options);
26ba25
     }
26ba25
 
26ba25
     bs_entry->state.bs = bs;
26ba25
@@ -3008,9 +3008,9 @@ cleanup:
26ba25
         if (ret && bs_entry->prepared) {
26ba25
             bdrv_reopen_abort(&bs_entry->state);
26ba25
         } else if (ret) {
26ba25
-            QDECREF(bs_entry->state.explicit_options);
26ba25
+            qobject_unref(bs_entry->state.explicit_options);
26ba25
         }
26ba25
-        QDECREF(bs_entry->state.options);
26ba25
+        qobject_unref(bs_entry->state.options);
26ba25
         g_free(bs_entry);
26ba25
     }
26ba25
     g_free(bs_queue);
26ba25
@@ -3253,7 +3253,7 @@ void bdrv_reopen_commit(BDRVReopenState *reopen_state)
26ba25
     }
26ba25
 
26ba25
     /* set BDS specific flags now */
26ba25
-    QDECREF(bs->explicit_options);
26ba25
+    qobject_unref(bs->explicit_options);
26ba25
 
26ba25
     bs->explicit_options   = reopen_state->explicit_options;
26ba25
     bs->open_flags         = reopen_state->flags;
26ba25
@@ -3296,7 +3296,7 @@ void bdrv_reopen_abort(BDRVReopenState *reopen_state)
26ba25
         drv->bdrv_reopen_abort(reopen_state);
26ba25
     }
26ba25
 
26ba25
-    QDECREF(reopen_state->explicit_options);
26ba25
+    qobject_unref(reopen_state->explicit_options);
26ba25
 
26ba25
     bdrv_abort_perm_update(reopen_state->bs);
26ba25
 }
26ba25
@@ -3343,11 +3343,11 @@ static void bdrv_close(BlockDriverState *bs)
26ba25
     bs->total_sectors = 0;
26ba25
     bs->encrypted = false;
26ba25
     bs->sg = false;
26ba25
-    QDECREF(bs->options);
26ba25
-    QDECREF(bs->explicit_options);
26ba25
+    qobject_unref(bs->options);
26ba25
+    qobject_unref(bs->explicit_options);
26ba25
     bs->options = NULL;
26ba25
     bs->explicit_options = NULL;
26ba25
-    QDECREF(bs->full_open_options);
26ba25
+    qobject_unref(bs->full_open_options);
26ba25
     bs->full_open_options = NULL;
26ba25
 
26ba25
     bdrv_release_named_dirty_bitmaps(bs);
26ba25
@@ -5134,7 +5134,7 @@ static bool append_open_options(QDict *d, BlockDriverState *bs)
26ba25
             continue;
26ba25
         }
26ba25
 
26ba25
-        qobject_incref(qdict_entry_value(entry));
26ba25
+        qobject_ref(qdict_entry_value(entry));
26ba25
         qdict_put_obj(d, qdict_entry_key(entry), qdict_entry_value(entry));
26ba25
         found_any = true;
26ba25
     }
26ba25
@@ -5174,21 +5174,21 @@ void bdrv_refresh_filename(BlockDriverState *bs)
26ba25
          * information before refreshing it */
26ba25
         bs->exact_filename[0] = '\0';
26ba25
         if (bs->full_open_options) {
26ba25
-            QDECREF(bs->full_open_options);
26ba25
+            qobject_unref(bs->full_open_options);
26ba25
             bs->full_open_options = NULL;
26ba25
         }
26ba25
 
26ba25
         opts = qdict_new();
26ba25
         append_open_options(opts, bs);
26ba25
         drv->bdrv_refresh_filename(bs, opts);
26ba25
-        QDECREF(opts);
26ba25
+        qobject_unref(opts);
26ba25
     } else if (bs->file) {
26ba25
         /* Try to reconstruct valid information from the underlying file */
26ba25
         bool has_open_options;
26ba25
 
26ba25
         bs->exact_filename[0] = '\0';
26ba25
         if (bs->full_open_options) {
26ba25
-            QDECREF(bs->full_open_options);
26ba25
+            qobject_unref(bs->full_open_options);
26ba25
             bs->full_open_options = NULL;
26ba25
         }
26ba25
 
26ba25
@@ -5207,12 +5207,12 @@ void bdrv_refresh_filename(BlockDriverState *bs)
26ba25
          * suffices without querying the (exact_)filename of this BDS. */
26ba25
         if (bs->file->bs->full_open_options) {
26ba25
             qdict_put_str(opts, "driver", drv->format_name);
26ba25
-            QINCREF(bs->file->bs->full_open_options);
26ba25
+            qobject_ref(bs->file->bs->full_open_options);
26ba25
             qdict_put(opts, "file", bs->file->bs->full_open_options);
26ba25
 
26ba25
             bs->full_open_options = opts;
26ba25
         } else {
26ba25
-            QDECREF(opts);
26ba25
+            qobject_unref(opts);
26ba25
         }
26ba25
     } else if (!bs->full_open_options && qdict_size(bs->options)) {
26ba25
         /* There is no underlying file BDS (at least referenced by BDS.file),
26ba25
@@ -5246,7 +5246,7 @@ void bdrv_refresh_filename(BlockDriverState *bs)
26ba25
         QString *json = qobject_to_json(QOBJECT(bs->full_open_options));
26ba25
         snprintf(bs->filename, sizeof(bs->filename), "json:%s",
26ba25
                  qstring_get_str(json));
26ba25
-        QDECREF(json);
26ba25
+        qobject_unref(json);
26ba25
     }
26ba25
 }
26ba25
 
26ba25
diff --git a/block/blkdebug.c b/block/blkdebug.c
26ba25
index 5897124..689703d 100644
26ba25
--- a/block/blkdebug.c
26ba25
+++ b/block/blkdebug.c
26ba25
@@ -845,12 +845,12 @@ static void blkdebug_refresh_filename(BlockDriverState *bs, QDict *options)
26ba25
     opts = qdict_new();
26ba25
     qdict_put_str(opts, "driver", "blkdebug");
26ba25
 
26ba25
-    QINCREF(bs->file->bs->full_open_options);
26ba25
+    qobject_ref(bs->file->bs->full_open_options);
26ba25
     qdict_put(opts, "image", bs->file->bs->full_open_options);
26ba25
 
26ba25
     for (e = qdict_first(options); e; e = qdict_next(options, e)) {
26ba25
         if (strcmp(qdict_entry_key(e), "x-image")) {
26ba25
-            qobject_incref(qdict_entry_value(e));
26ba25
+            qobject_ref(qdict_entry_value(e));
26ba25
             qdict_put_obj(opts, qdict_entry_key(e), qdict_entry_value(e));
26ba25
         }
26ba25
     }
26ba25
diff --git a/block/blkverify.c b/block/blkverify.c
26ba25
index 331365b..3cffcb1 100644
26ba25
--- a/block/blkverify.c
26ba25
+++ b/block/blkverify.c
26ba25
@@ -291,9 +291,9 @@ static void blkverify_refresh_filename(BlockDriverState *bs, QDict *options)
26ba25
         QDict *opts = qdict_new();
26ba25
         qdict_put_str(opts, "driver", "blkverify");
26ba25
 
26ba25
-        QINCREF(bs->file->bs->full_open_options);
26ba25
+        qobject_ref(bs->file->bs->full_open_options);
26ba25
         qdict_put(opts, "raw", bs->file->bs->full_open_options);
26ba25
-        QINCREF(s->test_file->bs->full_open_options);
26ba25
+        qobject_ref(s->test_file->bs->full_open_options);
26ba25
         qdict_put(opts, "test", s->test_file->bs->full_open_options);
26ba25
 
26ba25
         bs->full_open_options = opts;
26ba25
diff --git a/block/crypto.c b/block/crypto.c
26ba25
index bc6c7e3..7e7ad2d 100644
26ba25
--- a/block/crypto.c
26ba25
+++ b/block/crypto.c
26ba25
@@ -305,7 +305,7 @@ static int block_crypto_open_generic(QCryptoBlockFormat format,
26ba25
 
26ba25
     ret = 0;
26ba25
  cleanup:
26ba25
-    QDECREF(cryptoopts);
26ba25
+    qobject_unref(cryptoopts);
26ba25
     qapi_free_QCryptoBlockOpenOptions(open_opts);
26ba25
     return ret;
26ba25
 }
26ba25
@@ -635,7 +635,7 @@ static int coroutine_fn block_crypto_co_create_opts_luks(const char *filename,
26ba25
 fail:
26ba25
     bdrv_unref(bs);
26ba25
     qapi_free_QCryptoBlockCreateOptions(create_opts);
26ba25
-    QDECREF(cryptoopts);
26ba25
+    qobject_unref(cryptoopts);
26ba25
     return ret;
26ba25
 }
26ba25
 
26ba25
diff --git a/block/gluster.c b/block/gluster.c
26ba25
index 4adc1a8..55be566 100644
26ba25
--- a/block/gluster.c
26ba25
+++ b/block/gluster.c
26ba25
@@ -650,7 +650,7 @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf,
26ba25
         }
26ba25
         gsconf = NULL;
26ba25
 
26ba25
-        QDECREF(backing_options);
26ba25
+        qobject_unref(backing_options);
26ba25
         backing_options = NULL;
26ba25
         g_free(str);
26ba25
         str = NULL;
26ba25
@@ -663,7 +663,7 @@ out:
26ba25
     qapi_free_SocketAddress(gsconf);
26ba25
     qemu_opts_del(opts);
26ba25
     g_free(str);
26ba25
-    QDECREF(backing_options);
26ba25
+    qobject_unref(backing_options);
26ba25
     errno = EINVAL;
26ba25
     return -errno;
26ba25
 }
26ba25
diff --git a/block/iscsi.c b/block/iscsi.c
26ba25
index f5aecfc..d19ae0e 100644
26ba25
--- a/block/iscsi.c
26ba25
+++ b/block/iscsi.c
26ba25
@@ -2143,7 +2143,7 @@ static int coroutine_fn iscsi_co_create_opts(const char *filename, QemuOpts *opt
26ba25
     } else {
26ba25
         ret = iscsi_open(bs, bs_options, 0, NULL);
26ba25
     }
26ba25
-    QDECREF(bs_options);
26ba25
+    qobject_unref(bs_options);
26ba25
 
26ba25
     if (ret != 0) {
26ba25
         goto out;
26ba25
diff --git a/block/nbd.c b/block/nbd.c
26ba25
index 1e2b3ba..3e1693c 100644
26ba25
--- a/block/nbd.c
26ba25
+++ b/block/nbd.c
26ba25
@@ -293,8 +293,8 @@ static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options,
26ba25
     }
26ba25
 
26ba25
 done:
26ba25
-    QDECREF(addr);
26ba25
-    qobject_decref(crumpled_addr);
26ba25
+    qobject_unref(addr);
26ba25
+    qobject_unref(crumpled_addr);
26ba25
     visit_free(iv);
26ba25
     return saddr;
26ba25
 }
26ba25
diff --git a/block/nfs.c b/block/nfs.c
26ba25
index 2577df4..66fddf1 100644
26ba25
--- a/block/nfs.c
26ba25
+++ b/block/nfs.c
26ba25
@@ -567,7 +567,7 @@ static BlockdevOptionsNfs *nfs_options_qdict_to_qapi(QDict *options,
26ba25
     v = qobject_input_visitor_new_keyval(crumpled);
26ba25
     visit_type_BlockdevOptionsNfs(v, NULL, &opts, &local_err);
26ba25
     visit_free(v);
26ba25
-    qobject_decref(crumpled);
26ba25
+    qobject_unref(crumpled);
26ba25
 
26ba25
     if (local_err) {
26ba25
         return NULL;
26ba25
@@ -683,7 +683,7 @@ static int coroutine_fn nfs_file_co_create_opts(const char *url, QemuOpts *opts,
26ba25
 
26ba25
     ret = 0;
26ba25
 out:
26ba25
-    QDECREF(options);
26ba25
+    qobject_unref(options);
26ba25
     qapi_free_BlockdevCreateOptions(create_options);
26ba25
     return ret;
26ba25
 }
26ba25
diff --git a/block/null.c b/block/null.c
26ba25
index 806a863..700a2d0 100644
26ba25
--- a/block/null.c
26ba25
+++ b/block/null.c
26ba25
@@ -244,7 +244,7 @@ static int coroutine_fn null_co_block_status(BlockDriverState *bs,
26ba25
 
26ba25
 static void null_refresh_filename(BlockDriverState *bs, QDict *opts)
26ba25
 {
26ba25
-    QINCREF(opts);
26ba25
+    qobject_ref(opts);
26ba25
     qdict_del(opts, "filename");
26ba25
 
26ba25
     if (!qdict_size(opts)) {
26ba25
diff --git a/block/nvme.c b/block/nvme.c
26ba25
index c4f3a7b..e192da9 100644
26ba25
--- a/block/nvme.c
26ba25
+++ b/block/nvme.c
26ba25
@@ -1073,7 +1073,7 @@ static int nvme_reopen_prepare(BDRVReopenState *reopen_state,
26ba25
 
26ba25
 static void nvme_refresh_filename(BlockDriverState *bs, QDict *opts)
26ba25
 {
26ba25
-    QINCREF(opts);
26ba25
+    qobject_ref(opts);
26ba25
     qdict_del(opts, "filename");
26ba25
 
26ba25
     if (!qdict_size(opts)) {
26ba25
diff --git a/block/parallels.c b/block/parallels.c
26ba25
index 799215e..045810d 100644
26ba25
--- a/block/parallels.c
26ba25
+++ b/block/parallels.c
26ba25
@@ -651,7 +651,7 @@ static int coroutine_fn parallels_co_create_opts(const char *filename,
26ba25
     qdict_put_str(qdict, "file", bs->node_name);
26ba25
 
26ba25
     qobj = qdict_crumple(qdict, errp);
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     qdict = qobject_to(QDict, qobj);
26ba25
     if (qdict == NULL) {
26ba25
         ret = -EINVAL;
26ba25
@@ -682,7 +682,7 @@ static int coroutine_fn parallels_co_create_opts(const char *filename,
26ba25
     ret = 0;
26ba25
 
26ba25
 done:
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     bdrv_unref(bs);
26ba25
     qapi_free_BlockdevCreateOptions(create_options);
26ba25
     return ret;
26ba25
diff --git a/block/qapi.c b/block/qapi.c
26ba25
index 04c6fc6..e12968f 100644
26ba25
--- a/block/qapi.c
26ba25
+++ b/block/qapi.c
26ba25
@@ -773,7 +773,7 @@ void bdrv_image_info_specific_dump(fprintf_function func_fprintf, void *f,
26ba25
     visit_complete(v, &obj);
26ba25
     data = qdict_get(qobject_to(QDict, obj), "data");
26ba25
     dump_qobject(func_fprintf, f, 1, data);
26ba25
-    qobject_decref(obj);
26ba25
+    qobject_unref(obj);
26ba25
     visit_free(v);
26ba25
 }
26ba25
 
26ba25
diff --git a/block/qcow.c b/block/qcow.c
26ba25
index f928916..4b2f7db 100644
26ba25
--- a/block/qcow.c
26ba25
+++ b/block/qcow.c
26ba25
@@ -315,7 +315,7 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
26ba25
         goto fail;
26ba25
     }
26ba25
 
26ba25
-    QDECREF(encryptopts);
26ba25
+    qobject_unref(encryptopts);
26ba25
     qapi_free_QCryptoBlockOpenOptions(crypto_opts);
26ba25
     qemu_co_mutex_init(&s->lock);
26ba25
     return 0;
26ba25
@@ -326,7 +326,7 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
26ba25
     g_free(s->cluster_cache);
26ba25
     g_free(s->cluster_data);
26ba25
     qcrypto_block_free(s->crypto);
26ba25
-    QDECREF(encryptopts);
26ba25
+    qobject_unref(encryptopts);
26ba25
     qapi_free_QCryptoBlockOpenOptions(crypto_opts);
26ba25
     return ret;
26ba25
 }
26ba25
@@ -995,7 +995,7 @@ static int coroutine_fn qcow_co_create_opts(const char *filename,
26ba25
     qdict_put_str(qdict, "file", bs->node_name);
26ba25
 
26ba25
     qobj = qdict_crumple(qdict, errp);
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     qdict = qobject_to(QDict, qobj);
26ba25
     if (qdict == NULL) {
26ba25
         ret = -EINVAL;
26ba25
@@ -1025,7 +1025,7 @@ static int coroutine_fn qcow_co_create_opts(const char *filename,
26ba25
 
26ba25
     ret = 0;
26ba25
 fail:
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     bdrv_unref(bs);
26ba25
     qapi_free_BlockdevCreateOptions(create_options);
26ba25
     return ret;
26ba25
diff --git a/block/qcow2.c b/block/qcow2.c
26ba25
index ef68772..2f36e63 100644
26ba25
--- a/block/qcow2.c
26ba25
+++ b/block/qcow2.c
26ba25
@@ -1063,7 +1063,7 @@ static int qcow2_update_options_prepare(BlockDriverState *bs,
26ba25
 
26ba25
     ret = 0;
26ba25
 fail:
26ba25
-    QDECREF(encryptopts);
26ba25
+    qobject_unref(encryptopts);
26ba25
     qemu_opts_del(opts);
26ba25
     opts = NULL;
26ba25
     return ret;
26ba25
@@ -2183,7 +2183,7 @@ static void coroutine_fn qcow2_co_invalidate_cache(BlockDriverState *bs,
26ba25
     qemu_co_mutex_lock(&s->lock);
26ba25
     ret = qcow2_do_open(bs, options, flags, &local_err);
26ba25
     qemu_co_mutex_unlock(&s->lock);
26ba25
-    QDECREF(options);
26ba25
+    qobject_unref(options);
26ba25
     if (local_err) {
26ba25
         error_propagate(errp, local_err);
26ba25
         error_prepend(errp, "Could not reopen qcow2 layer: ");
26ba25
@@ -3139,7 +3139,7 @@ static int coroutine_fn qcow2_co_create_opts(const char *filename, QemuOpts *opt
26ba25
 
26ba25
     /* Now get the QAPI type BlockdevCreateOptions */
26ba25
     qobj = qdict_crumple(qdict, errp);
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     qdict = qobject_to(QDict, qobj);
26ba25
     if (qdict == NULL) {
26ba25
         ret = -EINVAL;
26ba25
@@ -3168,7 +3168,7 @@ static int coroutine_fn qcow2_co_create_opts(const char *filename, QemuOpts *opt
26ba25
 
26ba25
     ret = 0;
26ba25
 finish:
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     bdrv_unref(bs);
26ba25
     qapi_free_BlockdevCreateOptions(create_options);
26ba25
     return ret;
26ba25
diff --git a/block/qed.c b/block/qed.c
26ba25
index 35ff505..1db8eaf 100644
26ba25
--- a/block/qed.c
26ba25
+++ b/block/qed.c
26ba25
@@ -763,7 +763,7 @@ static int coroutine_fn bdrv_qed_co_create_opts(const char *filename,
26ba25
     qdict_put_str(qdict, "file", bs->node_name);
26ba25
 
26ba25
     qobj = qdict_crumple(qdict, errp);
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     qdict = qobject_to(QDict, qobj);
26ba25
     if (qdict == NULL) {
26ba25
         ret = -EINVAL;
26ba25
@@ -789,7 +789,7 @@ static int coroutine_fn bdrv_qed_co_create_opts(const char *filename,
26ba25
     ret = bdrv_qed_co_create(create_options, errp);
26ba25
 
26ba25
 fail:
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     bdrv_unref(bs);
26ba25
     qapi_free_BlockdevCreateOptions(create_options);
26ba25
     return ret;
26ba25
diff --git a/block/quorum.c b/block/quorum.c
26ba25
index cfe484a..862cea3 100644
26ba25
--- a/block/quorum.c
26ba25
+++ b/block/quorum.c
26ba25
@@ -1082,7 +1082,7 @@ static void quorum_refresh_filename(BlockDriverState *bs, QDict *options)
26ba25
 
26ba25
     children = qlist_new();
26ba25
     for (i = 0; i < s->num_children; i++) {
26ba25
-        QINCREF(s->children[i]->bs->full_open_options);
26ba25
+        qobject_ref(s->children[i]->bs->full_open_options);
26ba25
         qlist_append(children, s->children[i]->bs->full_open_options);
26ba25
     }
26ba25
 
26ba25
diff --git a/block/rbd.c b/block/rbd.c
26ba25
index c9359d0..a14b42f 100644
26ba25
--- a/block/rbd.c
26ba25
+++ b/block/rbd.c
26ba25
@@ -226,7 +226,7 @@ static void qemu_rbd_parse_filename(const char *filename, QDict *options,
26ba25
 
26ba25
 done:
26ba25
     g_free(buf);
26ba25
-    QDECREF(keypairs);
26ba25
+    qobject_unref(keypairs);
26ba25
     return;
26ba25
 }
26ba25
 
26ba25
@@ -275,17 +275,17 @@ static int qemu_rbd_set_keypairs(rados_t cluster, const char *keypairs_json,
26ba25
         key = qstring_get_str(name);
26ba25
 
26ba25
         ret = rados_conf_set(cluster, key, qstring_get_str(value));
26ba25
-        QDECREF(value);
26ba25
+        qobject_unref(value);
26ba25
         if (ret < 0) {
26ba25
             error_setg_errno(errp, -ret, "invalid conf option %s", key);
26ba25
-            QDECREF(name);
26ba25
+            qobject_unref(name);
26ba25
             ret = -EINVAL;
26ba25
             break;
26ba25
         }
26ba25
-        QDECREF(name);
26ba25
+        qobject_unref(name);
26ba25
     }
26ba25
 
26ba25
-    QDECREF(keypairs);
26ba25
+    qobject_unref(keypairs);
26ba25
     return ret;
26ba25
 }
26ba25
 
26ba25
@@ -449,7 +449,7 @@ static int coroutine_fn qemu_rbd_co_create_opts(const char *filename,
26ba25
     }
26ba25
 
26ba25
 exit:
26ba25
-    QDECREF(options);
26ba25
+    qobject_unref(options);
26ba25
     qapi_free_BlockdevCreateOptions(create_options);
26ba25
     return ret;
26ba25
 }
26ba25
@@ -664,7 +664,7 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
26ba25
     v = qobject_input_visitor_new_keyval(crumpled);
26ba25
     visit_type_BlockdevOptionsRbd(v, NULL, &opts, &local_err);
26ba25
     visit_free(v);
26ba25
-    qobject_decref(crumpled);
26ba25
+    qobject_unref(crumpled);
26ba25
 
26ba25
     if (local_err) {
26ba25
         error_propagate(errp, local_err);
26ba25
diff --git a/block/sheepdog.c b/block/sheepdog.c
26ba25
index 387f59c..07529f4 100644
26ba25
--- a/block/sheepdog.c
26ba25
+++ b/block/sheepdog.c
26ba25
@@ -567,8 +567,8 @@ static SocketAddress *sd_server_config(QDict *options, Error **errp)
26ba25
 
26ba25
 done:
26ba25
     visit_free(iv);
26ba25
-    qobject_decref(crumpled_server);
26ba25
-    QDECREF(server);
26ba25
+    qobject_unref(crumpled_server);
26ba25
+    qobject_unref(server);
26ba25
     return saddr;
26ba25
 }
26ba25
 
26ba25
@@ -1883,7 +1883,7 @@ static int sd_create_prealloc(BlockdevOptionsSheepdog *location, int64_t size,
26ba25
 
26ba25
     if (local_err) {
26ba25
         error_propagate(errp, local_err);
26ba25
-        qobject_decref(obj);
26ba25
+        qobject_unref(obj);
26ba25
         return -EINVAL;
26ba25
     }
26ba25
 
26ba25
@@ -1901,7 +1901,7 @@ static int sd_create_prealloc(BlockdevOptionsSheepdog *location, int64_t size,
26ba25
     ret = sd_prealloc(bs, 0, size, errp);
26ba25
 fail:
26ba25
     bdrv_unref(bs);
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     return ret;
26ba25
 }
26ba25
 
26ba25
@@ -2226,7 +2226,7 @@ static int coroutine_fn sd_co_create_opts(const char *filename, QemuOpts *opts,
26ba25
     v = qobject_input_visitor_new_keyval(crumpled);
26ba25
     visit_type_BlockdevCreateOptions(v, NULL, &create_options, &local_err);
26ba25
     visit_free(v);
26ba25
-    qobject_decref(crumpled);
26ba25
+    qobject_unref(crumpled);
26ba25
 
26ba25
     if (local_err) {
26ba25
         error_propagate(errp, local_err);
26ba25
@@ -2252,7 +2252,7 @@ static int coroutine_fn sd_co_create_opts(const char *filename, QemuOpts *opts,
26ba25
     ret = sd_co_create(create_options, errp);
26ba25
 fail:
26ba25
     qapi_free_BlockdevCreateOptions(create_options);
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     return ret;
26ba25
 }
26ba25
 
26ba25
diff --git a/block/snapshot.c b/block/snapshot.c
26ba25
index eacc1f1..2953d96 100644
26ba25
--- a/block/snapshot.c
26ba25
+++ b/block/snapshot.c
26ba25
@@ -214,7 +214,7 @@ int bdrv_snapshot_goto(BlockDriverState *bs,
26ba25
         bdrv_ref(file);
26ba25
 
26ba25
         qdict_extract_subqdict(options, &file_options, "file.");
26ba25
-        QDECREF(file_options);
26ba25
+        qobject_unref(file_options);
26ba25
         qdict_put_str(options, "file", bdrv_get_node_name(file));
26ba25
 
26ba25
         drv->bdrv_close(bs);
26ba25
@@ -223,7 +223,7 @@ int bdrv_snapshot_goto(BlockDriverState *bs,
26ba25
 
26ba25
         ret = bdrv_snapshot_goto(file, snapshot_id, errp);
26ba25
         open_ret = drv->bdrv_open(bs, options, bs->open_flags, &local_err);
26ba25
-        QDECREF(options);
26ba25
+        qobject_unref(options);
26ba25
         if (open_ret < 0) {
26ba25
             bdrv_unref(file);
26ba25
             bs->drv = NULL;
26ba25
diff --git a/block/ssh.c b/block/ssh.c
26ba25
index ab3acf0..412a1bf 100644
26ba25
--- a/block/ssh.c
26ba25
+++ b/block/ssh.c
26ba25
@@ -638,7 +638,7 @@ static BlockdevOptionsSsh *ssh_parse_options(QDict *options, Error **errp)
26ba25
     v = qobject_input_visitor_new(crumpled);
26ba25
     visit_type_BlockdevOptionsSsh(v, NULL, &result, &local_err);
26ba25
     visit_free(v);
26ba25
-    qobject_decref(crumpled);
26ba25
+    qobject_unref(crumpled);
26ba25
 
26ba25
     if (local_err) {
26ba25
         error_propagate(errp, local_err);
26ba25
@@ -917,7 +917,7 @@ static int coroutine_fn ssh_co_create_opts(const char *filename, QemuOpts *opts,
26ba25
     ret = ssh_co_create(create_options, errp);
26ba25
 
26ba25
  out:
26ba25
-    QDECREF(uri_options);
26ba25
+    qobject_unref(uri_options);
26ba25
     qapi_free_BlockdevCreateOptions(create_options);
26ba25
     return ret;
26ba25
 }
26ba25
diff --git a/block/vdi.c b/block/vdi.c
26ba25
index 4a2d1ff..96a22b8 100644
26ba25
--- a/block/vdi.c
26ba25
+++ b/block/vdi.c
26ba25
@@ -951,7 +951,7 @@ static int coroutine_fn vdi_co_create_opts(const char *filename, QemuOpts *opts,
26ba25
     /* Create the vdi image (format layer) */
26ba25
     ret = vdi_co_do_create(create_options, block_size, errp);
26ba25
 done:
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     qapi_free_BlockdevCreateOptions(create_options);
26ba25
     bdrv_unref(bs_file);
26ba25
     return ret;
26ba25
diff --git a/block/vhdx.c b/block/vhdx.c
26ba25
index 6ac0424..c3a4220 100644
26ba25
--- a/block/vhdx.c
26ba25
+++ b/block/vhdx.c
26ba25
@@ -2003,7 +2003,7 @@ static int coroutine_fn vhdx_co_create_opts(const char *filename,
26ba25
     qdict_put_str(qdict, "file", bs->node_name);
26ba25
 
26ba25
     qobj = qdict_crumple(qdict, errp);
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     qdict = qobject_to(QDict, qobj);
26ba25
     if (qdict == NULL) {
26ba25
         ret = -EINVAL;
26ba25
@@ -2049,7 +2049,7 @@ static int coroutine_fn vhdx_co_create_opts(const char *filename,
26ba25
     ret = vhdx_co_create(create_options, errp);
26ba25
 
26ba25
 fail:
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     bdrv_unref(bs);
26ba25
     qapi_free_BlockdevCreateOptions(create_options);
26ba25
     return ret;
26ba25
diff --git a/block/vpc.c b/block/vpc.c
26ba25
index 44f99a4..0ebfcd3 100644
26ba25
--- a/block/vpc.c
26ba25
+++ b/block/vpc.c
26ba25
@@ -1119,7 +1119,7 @@ static int coroutine_fn vpc_co_create_opts(const char *filename,
26ba25
     qdict_put_str(qdict, "file", bs->node_name);
26ba25
 
26ba25
     qobj = qdict_crumple(qdict, errp);
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     qdict = qobject_to(QDict, qobj);
26ba25
     if (qdict == NULL) {
26ba25
         ret = -EINVAL;
26ba25
@@ -1157,7 +1157,7 @@ static int coroutine_fn vpc_co_create_opts(const char *filename,
26ba25
     ret = vpc_co_create(create_options, errp);
26ba25
 
26ba25
 fail:
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     bdrv_unref(bs);
26ba25
     qapi_free_BlockdevCreateOptions(create_options);
26ba25
     return ret;
26ba25
diff --git a/block/vvfat.c b/block/vvfat.c
26ba25
index 1569783..662dca0 100644
26ba25
--- a/block/vvfat.c
26ba25
+++ b/block/vvfat.c
26ba25
@@ -3179,7 +3179,7 @@ static int enable_write_target(BlockDriverState *bs, Error **errp)
26ba25
     qdict_put_str(options, "write-target.driver", "qcow");
26ba25
     s->qcow = bdrv_open_child(s->qcow_filename, options, "write-target", bs,
26ba25
                               &child_vvfat_qcow, false, errp);
26ba25
-    QDECREF(options);
26ba25
+    qobject_unref(options);
26ba25
     if (!s->qcow) {
26ba25
         ret = -EINVAL;
26ba25
         goto err;
26ba25
diff --git a/block/vxhs.c b/block/vxhs.c
26ba25
index 68edb51..96e83d9 100644
26ba25
--- a/block/vxhs.c
26ba25
+++ b/block/vxhs.c
26ba25
@@ -497,7 +497,7 @@ static int vxhs_open(BlockDriverState *bs, QDict *options,
26ba25
 
26ba25
 out:
26ba25
     g_free(of_vsa_addr);
26ba25
-    QDECREF(backing_options);
26ba25
+    qobject_unref(backing_options);
26ba25
     qemu_opts_del(tcp_opts);
26ba25
     qemu_opts_del(opts);
26ba25
     g_free(cacert);
26ba25
diff --git a/blockdev.c b/blockdev.c
26ba25
index c31bf3d..3808b1f 100644
26ba25
--- a/blockdev.c
26ba25
+++ b/blockdev.c
26ba25
@@ -576,7 +576,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
26ba25
         blk_rs->read_only     = read_only;
26ba25
         blk_rs->detect_zeroes = detect_zeroes;
26ba25
 
26ba25
-        QDECREF(bs_opts);
26ba25
+        qobject_unref(bs_opts);
26ba25
     } else {
26ba25
         if (file && !*file) {
26ba25
             file = NULL;
26ba25
@@ -632,16 +632,16 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
26ba25
 
26ba25
 err_no_bs_opts:
26ba25
     qemu_opts_del(opts);
26ba25
-    QDECREF(interval_dict);
26ba25
-    QDECREF(interval_list);
26ba25
+    qobject_unref(interval_dict);
26ba25
+    qobject_unref(interval_list);
26ba25
     return blk;
26ba25
 
26ba25
 early_err:
26ba25
     qemu_opts_del(opts);
26ba25
-    QDECREF(interval_dict);
26ba25
-    QDECREF(interval_list);
26ba25
+    qobject_unref(interval_dict);
26ba25
+    qobject_unref(interval_list);
26ba25
 err_no_opts:
26ba25
-    QDECREF(bs_opts);
26ba25
+    qobject_unref(bs_opts);
26ba25
     return NULL;
26ba25
 }
26ba25
 
26ba25
@@ -1130,7 +1130,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
26ba25
 
26ba25
 fail:
26ba25
     qemu_opts_del(legacy_opts);
26ba25
-    QDECREF(bs_opts);
26ba25
+    qobject_unref(bs_opts);
26ba25
     return dinfo;
26ba25
 }
26ba25
 
26ba25
@@ -4022,7 +4022,7 @@ void hmp_drive_add_node(Monitor *mon, const char *optstr)
26ba25
     qdict = qemu_opts_to_qdict(opts, NULL);
26ba25
 
26ba25
     if (!qdict_get_try_str(qdict, "node-name")) {
26ba25
-        QDECREF(qdict);
26ba25
+        qobject_unref(qdict);
26ba25
         error_report("'node-name' needs to be specified");
26ba25
         goto out;
26ba25
     }
26ba25
diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt
26ba25
index a569d24..b9b6eab 100644
26ba25
--- a/docs/devel/qapi-code-gen.txt
26ba25
+++ b/docs/devel/qapi-code-gen.txt
26ba25
@@ -1340,7 +1340,7 @@ Example:
26ba25
         emit(EXAMPLE_QAPI_EVENT_MY_EVENT, qmp, &err);
26ba25
 
26ba25
         error_propagate(errp, err);
26ba25
-        QDECREF(qmp);
26ba25
+        qobject_unref(qmp);
26ba25
     }
26ba25
 
26ba25
     const QEnumLookup example_QAPIEvent_lookup = {
26ba25
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
26ba25
index 976d151..b309a97 100644
26ba25
--- a/hw/i386/acpi-build.c
26ba25
+++ b/hw/i386/acpi-build.c
26ba25
@@ -201,21 +201,21 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)
26ba25
     } else {
26ba25
         pm->s3_disabled = false;
26ba25
     }
26ba25
-    qobject_decref(o);
26ba25
+    qobject_unref(o);
26ba25
     o = object_property_get_qobject(obj, ACPI_PM_PROP_S4_DISABLED, NULL);
26ba25
     if (o) {
26ba25
         pm->s4_disabled = qnum_get_uint(qobject_to(QNum, o));
26ba25
     } else {
26ba25
         pm->s4_disabled = false;
26ba25
     }
26ba25
-    qobject_decref(o);
26ba25
+    qobject_unref(o);
26ba25
     o = object_property_get_qobject(obj, ACPI_PM_PROP_S4_VAL, NULL);
26ba25
     if (o) {
26ba25
         pm->s4_val = qnum_get_uint(qobject_to(QNum, o));
26ba25
     } else {
26ba25
         pm->s4_val = false;
26ba25
     }
26ba25
-    qobject_decref(o);
26ba25
+    qobject_unref(o);
26ba25
 
26ba25
     pm->pcihp_bridge_en =
26ba25
         object_property_get_bool(obj, "acpi-pci-hotplug-with-bridge-support",
26ba25
@@ -573,7 +573,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
26ba25
         }
26ba25
     }
26ba25
     aml_append(parent_scope, method);
26ba25
-    qobject_decref(bsel);
26ba25
+    qobject_unref(bsel);
26ba25
 }
26ba25
 
26ba25
 /**
26ba25
@@ -2617,12 +2617,12 @@ static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg)
26ba25
         return false;
26ba25
     }
26ba25
     mcfg->mcfg_base = qnum_get_uint(qobject_to(QNum, o));
26ba25
-    qobject_decref(o);
26ba25
+    qobject_unref(o);
26ba25
 
26ba25
     o = object_property_get_qobject(pci_host, PCIE_HOST_MCFG_SIZE, NULL);
26ba25
     assert(o);
26ba25
     mcfg->mcfg_size = qnum_get_uint(qobject_to(QNum, o));
26ba25
-    qobject_decref(o);
26ba25
+    qobject_unref(o);
26ba25
     return true;
26ba25
 }
26ba25
 
26ba25
diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
26ba25
index aa25113..8a045d6 100644
26ba25
--- a/hw/ppc/spapr_drc.c
26ba25
+++ b/hw/ppc/spapr_drc.c
26ba25
@@ -305,7 +305,7 @@ static void prop_get_fdt(Object *obj, Visitor *v, const char *name,
26ba25
 
26ba25
     if (!drc->fdt) {
26ba25
         visit_type_null(v, NULL, &null, errp);
26ba25
-        QDECREF(null);
26ba25
+        qobject_unref(null);
26ba25
         return;
26ba25
     }
26ba25
 
26ba25
diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c
26ba25
index 3beeb0d..b3a90c0 100644
26ba25
--- a/hw/usb/xen-usb.c
26ba25
+++ b/hw/usb/xen-usb.c
26ba25
@@ -763,7 +763,7 @@ static void usbback_portid_add(struct usbback_info *usbif, unsigned port,
26ba25
     if (!usbif->ports[port - 1].dev) {
26ba25
         goto err;
26ba25
     }
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     speed = usbif->ports[port - 1].dev->speed;
26ba25
     switch (speed) {
26ba25
     case USB_SPEED_LOW:
26ba25
@@ -796,7 +796,7 @@ static void usbback_portid_add(struct usbback_info *usbif, unsigned port,
26ba25
     return;
26ba25
 
26ba25
 err:
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     xen_pv_printf(&usbif->xendev, 0, "device %s could not be opened\n", busid);
26ba25
 }
26ba25
 
26ba25
diff --git a/include/qapi/qmp/qnull.h b/include/qapi/qmp/qnull.h
26ba25
index e8ea2c3..75b29c6 100644
26ba25
--- a/include/qapi/qmp/qnull.h
26ba25
+++ b/include/qapi/qmp/qnull.h
26ba25
@@ -23,7 +23,7 @@ extern QNull qnull_;
26ba25
 
26ba25
 static inline QNull *qnull(void)
26ba25
 {
26ba25
-    QINCREF(&qnull_);
26ba25
+    qobject_ref(&qnull_);
26ba25
     return &qnull_;
26ba25
 }
26ba25
 
26ba25
diff --git a/include/qapi/qmp/qobject.h b/include/qapi/qmp/qobject.h
26ba25
index a713c01..e20006f 100644
26ba25
--- a/include/qapi/qmp/qobject.h
26ba25
+++ b/include/qapi/qmp/qobject.h
26ba25
@@ -15,17 +15,17 @@
26ba25
  * ------------------------------------
26ba25
  *
26ba25
  *  - Returning references: A function that returns an object may
26ba25
- *  return it as either a weak or a strong reference.  If the reference
26ba25
- *  is strong, you are responsible for calling QDECREF() on the reference
26ba25
- *  when you are done.
26ba25
+ *  return it as either a weak or a strong reference.  If the
26ba25
+ *  reference is strong, you are responsible for calling
26ba25
+ *  qobject_unref() on the reference when you are done.
26ba25
  *
26ba25
  *  If the reference is weak, the owner of the reference may free it at
26ba25
  *  any time in the future.  Before storing the reference anywhere, you
26ba25
- *  should call QINCREF() to make the reference strong.
26ba25
+ *  should call qobject_ref() to make the reference strong.
26ba25
  *
26ba25
  *  - Transferring ownership: when you transfer ownership of a reference
26ba25
  *  by calling a function, you are no longer responsible for calling
26ba25
- *  QDECREF() when the reference is no longer needed.  In other words,
26ba25
+ *  qobject_unref() when the reference is no longer needed.  In other words,
26ba25
  *  when the function returns you must behave as if the reference to the
26ba25
  *  passed object was weak.
26ba25
  */
26ba25
@@ -50,14 +50,6 @@ struct QObject {
26ba25
     _obj ? container_of(&(_obj)->base, QObject, base) : NULL;   \
26ba25
 })
26ba25
 
26ba25
-/* High-level interface for qobject_incref() */
26ba25
-#define QINCREF(obj)      \
26ba25
-    qobject_incref(QOBJECT(obj))
26ba25
-
26ba25
-/* High-level interface for qobject_decref() */
26ba25
-#define QDECREF(obj)              \
26ba25
-    qobject_decref(obj ? QOBJECT(obj) : NULL)
26ba25
-
26ba25
 /* Required for qobject_to() */
26ba25
 #define QTYPE_CAST_TO_QNull     QTYPE_QNULL
26ba25
 #define QTYPE_CAST_TO_QNum      QTYPE_QNUM
26ba25
@@ -80,10 +72,7 @@ static inline void qobject_init(QObject *obj, QType type)
26ba25
     obj->base.type = type;
26ba25
 }
26ba25
 
26ba25
-/**
26ba25
- * qobject_incref(): Increment QObject's reference count
26ba25
- */
26ba25
-static inline void qobject_incref(QObject *obj)
26ba25
+static inline void qobject_ref_impl(QObject *obj)
26ba25
 {
26ba25
     if (obj) {
26ba25
         obj->base.refcnt++;
26ba25
@@ -104,11 +93,7 @@ bool qobject_is_equal(const QObject *x, const QObject *y);
26ba25
  */
26ba25
 void qobject_destroy(QObject *obj);
26ba25
 
26ba25
-/**
26ba25
- * qobject_decref(): Decrement QObject's reference count, deallocate
26ba25
- * when it reaches zero
26ba25
- */
26ba25
-static inline void qobject_decref(QObject *obj)
26ba25
+static inline void qobject_unref_impl(QObject *obj)
26ba25
 {
26ba25
     assert(!obj || obj->base.refcnt);
26ba25
     if (obj && --obj->base.refcnt == 0) {
26ba25
@@ -117,6 +102,17 @@ static inline void qobject_decref(QObject *obj)
26ba25
 }
26ba25
 
26ba25
 /**
26ba25
+ * qobject_ref(): Increment QObject's reference count
26ba25
+ */
26ba25
+#define qobject_ref(obj) qobject_ref_impl(QOBJECT(obj))
26ba25
+
26ba25
+/**
26ba25
+ * qobject_unref(): Decrement QObject's reference count, deallocate
26ba25
+ * when it reaches zero
26ba25
+ */
26ba25
+#define qobject_unref(obj) qobject_unref_impl(QOBJECT(obj))
26ba25
+
26ba25
+/**
26ba25
  * qobject_type(): Return the QObject's type
26ba25
  */
26ba25
 static inline QType qobject_type(const QObject *obj)
26ba25
diff --git a/migration/migration.c b/migration/migration.c
26ba25
index ceb1697..ef4bb42 100644
26ba25
--- a/migration/migration.c
26ba25
+++ b/migration/migration.c
26ba25
@@ -1008,14 +1008,14 @@ void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp)
26ba25
     /* TODO Rewrite "" to null instead */
26ba25
     if (params->has_tls_creds
26ba25
         && params->tls_creds->type == QTYPE_QNULL) {
26ba25
-        QDECREF(params->tls_creds->u.n);
26ba25
+        qobject_unref(params->tls_creds->u.n);
26ba25
         params->tls_creds->type = QTYPE_QSTRING;
26ba25
         params->tls_creds->u.s = strdup("");
26ba25
     }
26ba25
     /* TODO Rewrite "" to null instead */
26ba25
     if (params->has_tls_hostname
26ba25
         && params->tls_hostname->type == QTYPE_QNULL) {
26ba25
-        QDECREF(params->tls_hostname->u.n);
26ba25
+        qobject_unref(params->tls_hostname->u.n);
26ba25
         params->tls_hostname->type = QTYPE_QSTRING;
26ba25
         params->tls_hostname->u.s = strdup("");
26ba25
     }
26ba25
diff --git a/migration/qjson.c b/migration/qjson.c
26ba25
index 9d7f6eb..e9889bd 100644
26ba25
--- a/migration/qjson.c
26ba25
+++ b/migration/qjson.c
26ba25
@@ -109,6 +109,6 @@ void qjson_finish(QJSON *json)
26ba25
 
26ba25
 void qjson_destroy(QJSON *json)
26ba25
 {
26ba25
-    QDECREF(json->str);
26ba25
+    qobject_unref(json->str);
26ba25
     g_free(json);
26ba25
 }
26ba25
diff --git a/monitor.c b/monitor.c
26ba25
index 39f8ee1..4f43eee 100644
26ba25
--- a/monitor.c
26ba25
+++ b/monitor.c
26ba25
@@ -329,8 +329,8 @@ int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,
26ba25
 
26ba25
 static void qmp_request_free(QMPRequest *req)
26ba25
 {
26ba25
-    qobject_decref(req->id);
26ba25
-    qobject_decref(req->req);
26ba25
+    qobject_unref(req->id);
26ba25
+    qobject_unref(req->req);
26ba25
     g_free(req);
26ba25
 }
26ba25
 
26ba25
@@ -346,7 +346,7 @@ static void monitor_qmp_cleanup_req_queue_locked(Monitor *mon)
26ba25
 static void monitor_qmp_cleanup_resp_queue_locked(Monitor *mon)
26ba25
 {
26ba25
     while (!g_queue_is_empty(mon->qmp.qmp_responses)) {
26ba25
-        qobject_decref(g_queue_pop_head(mon->qmp.qmp_responses));
26ba25
+        qobject_unref((QObject *)g_queue_pop_head(mon->qmp.qmp_responses));
26ba25
     }
26ba25
 }
26ba25
 
26ba25
@@ -391,14 +391,14 @@ static void monitor_flush_locked(Monitor *mon)
26ba25
         rc = qemu_chr_fe_write(&mon->chr, (const uint8_t *) buf, len);
26ba25
         if ((rc < 0 && errno != EAGAIN) || (rc == len)) {
26ba25
             /* all flushed or error */
26ba25
-            QDECREF(mon->outbuf);
26ba25
+            qobject_unref(mon->outbuf);
26ba25
             mon->outbuf = qstring_new();
26ba25
             return;
26ba25
         }
26ba25
         if (rc > 0) {
26ba25
             /* partial write */
26ba25
             QString *tmp = qstring_from_str(buf + rc);
26ba25
-            QDECREF(mon->outbuf);
26ba25
+            qobject_unref(mon->outbuf);
26ba25
             mon->outbuf = tmp;
26ba25
         }
26ba25
         if (mon->out_watch == 0) {
26ba25
@@ -482,7 +482,7 @@ static void monitor_json_emitter_raw(Monitor *mon,
26ba25
     qstring_append_chr(json, '\n');
26ba25
     monitor_puts(mon, qstring_get_str(json));
26ba25
 
26ba25
-    QDECREF(json);
26ba25
+    qobject_unref(json);
26ba25
 }
26ba25
 
26ba25
 static void monitor_json_emitter(Monitor *mon, QObject *data)
26ba25
@@ -494,9 +494,9 @@ static void monitor_json_emitter(Monitor *mon, QObject *data)
26ba25
          * caller won't free the data (which will be finally freed in
26ba25
          * responder thread).
26ba25
          */
26ba25
-        qobject_incref(data);
26ba25
+        qobject_ref(data);
26ba25
         qemu_mutex_lock(&mon->qmp.qmp_queue_lock);
26ba25
-        g_queue_push_tail(mon->qmp.qmp_responses, (void *)data);
26ba25
+        g_queue_push_tail(mon->qmp.qmp_responses, data);
26ba25
         qemu_mutex_unlock(&mon->qmp.qmp_queue_lock);
26ba25
         qemu_bh_schedule(mon_global.qmp_respond_bh);
26ba25
     } else {
26ba25
@@ -546,7 +546,7 @@ static void monitor_qmp_bh_responder(void *opaque)
26ba25
             break;
26ba25
         }
26ba25
         monitor_json_emitter_raw(response.mon, response.data);
26ba25
-        qobject_decref(response.data);
26ba25
+        qobject_unref(response.data);
26ba25
     }
26ba25
 }
26ba25
 
26ba25
@@ -613,9 +613,9 @@ monitor_qapi_event_queue(QAPIEvent event, QDict *qdict, Error **errp)
26ba25
              * last send.  Store event for sending when timer fires,
26ba25
              * replacing a prior stored event if any.
26ba25
              */
26ba25
-            QDECREF(evstate->qdict);
26ba25
+            qobject_unref(evstate->qdict);
26ba25
             evstate->qdict = qdict;
26ba25
-            QINCREF(evstate->qdict);
26ba25
+            qobject_ref(evstate->qdict);
26ba25
         } else {
26ba25
             /*
26ba25
              * Last send was (at least) evconf->rate ns ago.
26ba25
@@ -630,7 +630,7 @@ monitor_qapi_event_queue(QAPIEvent event, QDict *qdict, Error **errp)
26ba25
             evstate = g_new(MonitorQAPIEventState, 1);
26ba25
             evstate->event = event;
26ba25
             evstate->data = data;
26ba25
-            QINCREF(evstate->data);
26ba25
+            qobject_ref(evstate->data);
26ba25
             evstate->qdict = NULL;
26ba25
             evstate->timer = timer_new_ns(event_clock_type,
26ba25
                                           monitor_qapi_event_handler,
26ba25
@@ -660,12 +660,12 @@ static void monitor_qapi_event_handler(void *opaque)
26ba25
         int64_t now = qemu_clock_get_ns(event_clock_type);
26ba25
 
26ba25
         monitor_qapi_event_emit(evstate->event, evstate->qdict);
26ba25
-        QDECREF(evstate->qdict);
26ba25
+        qobject_unref(evstate->qdict);
26ba25
         evstate->qdict = NULL;
26ba25
         timer_mod_ns(evstate->timer, now + evconf->rate);
26ba25
     } else {
26ba25
         g_hash_table_remove(monitor_qapi_event_state, evstate);
26ba25
-        QDECREF(evstate->data);
26ba25
+        qobject_unref(evstate->data);
26ba25
         timer_free(evstate->timer);
26ba25
         g_free(evstate);
26ba25
     }
26ba25
@@ -747,7 +747,7 @@ static void monitor_data_destroy(Monitor *mon)
26ba25
         json_message_parser_destroy(&mon->qmp.parser);
26ba25
     }
26ba25
     readline_free(mon->rs);
26ba25
-    QDECREF(mon->outbuf);
26ba25
+    qobject_unref(mon->outbuf);
26ba25
     qemu_mutex_destroy(&mon->out_lock);
26ba25
     qemu_mutex_destroy(&mon->qmp.qmp_queue_lock);
26ba25
     monitor_qmp_cleanup_req_queue_locked(mon);
26ba25
@@ -3362,7 +3362,7 @@ static QDict *monitor_parse_arguments(Monitor *mon,
26ba25
     return qdict;
26ba25
 
26ba25
 fail:
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
     g_free(key);
26ba25
     return NULL;
26ba25
 }
26ba25
@@ -3387,7 +3387,7 @@ static void handle_hmp_command(Monitor *mon, const char *cmdline)
26ba25
     }
26ba25
 
26ba25
     cmd->cmd(mon, qdict);
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
 }
26ba25
 
26ba25
 static void cmd_completion(Monitor *mon, const char *name, const char *list)
26ba25
@@ -4049,15 +4049,15 @@ static void monitor_qmp_respond(Monitor *mon, QObject *rsp,
26ba25
     if (rsp) {
26ba25
         if (id) {
26ba25
             /* This is for the qdict below. */
26ba25
-            qobject_incref(id);
26ba25
+            qobject_ref(id);
26ba25
             qdict_put_obj(qobject_to(QDict, rsp), "id", id);
26ba25
         }
26ba25
 
26ba25
         monitor_json_emitter(mon, rsp);
26ba25
     }
26ba25
 
26ba25
-    qobject_decref(id);
26ba25
-    qobject_decref(rsp);
26ba25
+    qobject_unref(id);
26ba25
+    qobject_unref(rsp);
26ba25
 }
26ba25
 
26ba25
 /*
26ba25
@@ -4080,7 +4080,7 @@ static void monitor_qmp_dispatch_one(QMPRequest *req_obj)
26ba25
     if (trace_event_get_state_backends(TRACE_HANDLE_QMP_COMMAND)) {
26ba25
         QString *req_json = qobject_to_json(req);
26ba25
         trace_handle_qmp_command(mon, qstring_get_str(req_json));
26ba25
-        QDECREF(req_json);
26ba25
+        qobject_unref(req_json);
26ba25
     }
26ba25
 
26ba25
     old_mon = cur_mon;
26ba25
@@ -4098,7 +4098,7 @@ static void monitor_qmp_dispatch_one(QMPRequest *req_obj)
26ba25
         monitor_resume(mon);
26ba25
     }
26ba25
 
26ba25
-    qobject_decref(req);
26ba25
+    qobject_unref(req);
26ba25
 }
26ba25
 
26ba25
 /*
26ba25
@@ -4190,7 +4190,7 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
26ba25
         goto err;
26ba25
     }
26ba25
 
26ba25
-    qobject_incref(id);
26ba25
+    qobject_ref(id);
26ba25
     qdict_del(qdict, "id");
26ba25
 
26ba25
     req_obj = g_new0(QMPRequest, 1);
26ba25
@@ -4245,7 +4245,7 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
26ba25
 
26ba25
 err:
26ba25
     monitor_qmp_respond(mon, NULL, err, NULL);
26ba25
-    qobject_decref(req);
26ba25
+    qobject_unref(req);
26ba25
 }
26ba25
 
26ba25
 static void monitor_qmp_read(void *opaque, const uint8_t *buf, int size)
26ba25
@@ -4364,7 +4364,7 @@ static void monitor_qmp_event(void *opaque, int event)
26ba25
         monitor_qmp_caps_reset(mon);
26ba25
         data = get_qmp_greeting(mon);
26ba25
         monitor_json_emitter(mon, data);
26ba25
-        qobject_decref(data);
26ba25
+        qobject_unref(data);
26ba25
         mon_refcount++;
26ba25
         break;
26ba25
     case CHR_EVENT_CLOSED:
26ba25
diff --git a/qapi/qapi-dealloc-visitor.c b/qapi/qapi-dealloc-visitor.c
26ba25
index fd23803..6b24afd 100644
26ba25
--- a/qapi/qapi-dealloc-visitor.c
26ba25
+++ b/qapi/qapi-dealloc-visitor.c
26ba25
@@ -99,7 +99,7 @@ static void qapi_dealloc_type_anything(Visitor *v, const char *name,
26ba25
                                        QObject **obj, Error **errp)
26ba25
 {
26ba25
     if (obj) {
26ba25
-        qobject_decref(*obj);
26ba25
+        qobject_unref(*obj);
26ba25
     }
26ba25
 }
26ba25
 
26ba25
@@ -107,7 +107,7 @@ static void qapi_dealloc_type_null(Visitor *v, const char *name,
26ba25
                                    QNull **obj, Error **errp)
26ba25
 {
26ba25
     if (obj) {
26ba25
-        QDECREF(*obj);
26ba25
+        qobject_unref(*obj);
26ba25
     }
26ba25
 }
26ba25
 
26ba25
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
26ba25
index dd05907..f9377b2 100644
26ba25
--- a/qapi/qmp-dispatch.c
26ba25
+++ b/qapi/qmp-dispatch.c
26ba25
@@ -105,7 +105,7 @@ static QObject *do_qmp_dispatch(QmpCommandList *cmds, QObject *request,
26ba25
         args = qdict_new();
26ba25
     } else {
26ba25
         args = qdict_get_qdict(dict, "arguments");
26ba25
-        QINCREF(args);
26ba25
+        qobject_ref(args);
26ba25
     }
26ba25
 
26ba25
     cmd->fn(args, &ret, &local_err);
26ba25
@@ -117,7 +117,7 @@ static QObject *do_qmp_dispatch(QmpCommandList *cmds, QObject *request,
26ba25
         ret = QOBJECT(qdict_new());
26ba25
     }
26ba25
 
26ba25
-    QDECREF(args);
26ba25
+    qobject_unref(args);
26ba25
 
26ba25
     return ret;
26ba25
 }
26ba25
@@ -166,7 +166,7 @@ QObject *qmp_dispatch(QmpCommandList *cmds, QObject *request)
26ba25
     } else if (ret) {
26ba25
         qdict_put_obj(rsp, "return", ret);
26ba25
     } else {
26ba25
-        QDECREF(rsp);
26ba25
+        qobject_unref(rsp);
26ba25
         return NULL;
26ba25
     }
26ba25
 
26ba25
diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c
26ba25
index a7569d5..7a290c4 100644
26ba25
--- a/qapi/qobject-input-visitor.c
26ba25
+++ b/qapi/qobject-input-visitor.c
26ba25
@@ -588,7 +588,7 @@ static void qobject_input_type_any(Visitor *v, const char *name, QObject **obj,
26ba25
         return;
26ba25
     }
26ba25
 
26ba25
-    qobject_incref(qobj);
26ba25
+    qobject_ref(qobj);
26ba25
     *obj = qobj;
26ba25
 }
26ba25
 
26ba25
@@ -652,7 +652,7 @@ static void qobject_input_free(Visitor *v)
26ba25
         qobject_input_stack_object_free(tos);
26ba25
     }
26ba25
 
26ba25
-    qobject_decref(qiv->root);
26ba25
+    qobject_unref(qiv->root);
26ba25
     if (qiv->errname) {
26ba25
         g_string_free(qiv->errname, TRUE);
26ba25
     }
26ba25
@@ -678,7 +678,7 @@ static QObjectInputVisitor *qobject_input_visitor_base_new(QObject *obj)
26ba25
     v->visitor.free = qobject_input_free;
26ba25
 
26ba25
     v->root = obj;
26ba25
-    qobject_incref(obj);
26ba25
+    qobject_ref(obj);
26ba25
 
26ba25
     return v;
26ba25
 }
26ba25
@@ -744,7 +744,7 @@ Visitor *qobject_input_visitor_new_str(const char *str,
26ba25
         }
26ba25
         v = qobject_input_visitor_new_keyval(QOBJECT(args));
26ba25
     }
26ba25
-    QDECREF(args);
26ba25
+    qobject_unref(args);
26ba25
 
26ba25
     return v;
26ba25
 }
26ba25
diff --git a/qapi/qobject-output-visitor.c b/qapi/qobject-output-visitor.c
26ba25
index 877e37e..3a933b4 100644
26ba25
--- a/qapi/qobject-output-visitor.c
26ba25
+++ b/qapi/qobject-output-visitor.c
26ba25
@@ -188,7 +188,7 @@ static void qobject_output_type_any(Visitor *v, const char *name,
26ba25
                                     QObject **obj, Error **errp)
26ba25
 {
26ba25
     QObjectOutputVisitor *qov = to_qov(v);
26ba25
-    qobject_incref(*obj);
26ba25
+    qobject_ref(*obj);
26ba25
     qobject_output_add_obj(qov, name, *obj);
26ba25
 }
26ba25
 
26ba25
@@ -201,7 +201,7 @@ static void qobject_output_type_null(Visitor *v, const char *name,
26ba25
 
26ba25
 /* Finish building, and return the root object.
26ba25
  * The root object is never null. The caller becomes the object's
26ba25
- * owner, and should use qobject_decref() when done with it.  */
26ba25
+ * owner, and should use qobject_unref() when done with it.  */
26ba25
 static void qobject_output_complete(Visitor *v, void *opaque)
26ba25
 {
26ba25
     QObjectOutputVisitor *qov = to_qov(v);
26ba25
@@ -210,7 +210,7 @@ static void qobject_output_complete(Visitor *v, void *opaque)
26ba25
     assert(qov->root && QSLIST_EMPTY(&qov->stack));
26ba25
     assert(opaque == qov->result);
26ba25
 
26ba25
-    qobject_incref(qov->root);
26ba25
+    qobject_ref(qov->root);
26ba25
     *qov->result = qov->root;
26ba25
     qov->result = NULL;
26ba25
 }
26ba25
@@ -226,7 +226,7 @@ static void qobject_output_free(Visitor *v)
26ba25
         g_free(e);
26ba25
     }
26ba25
 
26ba25
-    qobject_decref(qov->root);
26ba25
+    qobject_unref(qov->root);
26ba25
     g_free(qov);
26ba25
 }
26ba25
 
26ba25
diff --git a/qemu-img.c b/qemu-img.c
26ba25
index 8320887..62b29e7 100644
26ba25
--- a/qemu-img.c
26ba25
+++ b/qemu-img.c
26ba25
@@ -279,7 +279,7 @@ static BlockBackend *img_open_opts(const char *optstr,
26ba25
         if (qdict_haskey(options, BDRV_OPT_FORCE_SHARE)
26ba25
             && !qdict_get_bool(options, BDRV_OPT_FORCE_SHARE)) {
26ba25
             error_report("--force-share/-U conflicts with image options");
26ba25
-            QDECREF(options);
26ba25
+            qobject_unref(options);
26ba25
             return NULL;
26ba25
         }
26ba25
         qdict_put_bool(options, BDRV_OPT_FORCE_SHARE, true);
26ba25
@@ -561,9 +561,9 @@ static void dump_json_image_check(ImageCheck *check, bool quiet)
26ba25
     str = qobject_to_json_pretty(obj);
26ba25
     assert(str != NULL);
26ba25
     qprintf(quiet, "%s\n", qstring_get_str(str));
26ba25
-    qobject_decref(obj);
26ba25
+    qobject_unref(obj);
26ba25
     visit_free(v);
26ba25
-    QDECREF(str);
26ba25
+    qobject_unref(str);
26ba25
 }
26ba25
 
26ba25
 static void dump_human_image_check(ImageCheck *check, bool quiet)
26ba25
@@ -2384,9 +2384,9 @@ static void dump_json_image_info_list(ImageInfoList *list)
26ba25
     str = qobject_to_json_pretty(obj);
26ba25
     assert(str != NULL);
26ba25
     printf("%s\n", qstring_get_str(str));
26ba25
-    qobject_decref(obj);
26ba25
+    qobject_unref(obj);
26ba25
     visit_free(v);
26ba25
-    QDECREF(str);
26ba25
+    qobject_unref(str);
26ba25
 }
26ba25
 
26ba25
 static void dump_json_image_info(ImageInfo *info)
26ba25
@@ -2400,9 +2400,9 @@ static void dump_json_image_info(ImageInfo *info)
26ba25
     str = qobject_to_json_pretty(obj);
26ba25
     assert(str != NULL);
26ba25
     printf("%s\n", qstring_get_str(str));
26ba25
-    qobject_decref(obj);
26ba25
+    qobject_unref(obj);
26ba25
     visit_free(v);
26ba25
-    QDECREF(str);
26ba25
+    qobject_unref(str);
26ba25
 }
26ba25
 
26ba25
 static void dump_human_image_info_list(ImageInfoList *list)
26ba25
@@ -4488,9 +4488,9 @@ static void dump_json_block_measure_info(BlockMeasureInfo *info)
26ba25
     str = qobject_to_json_pretty(obj);
26ba25
     assert(str != NULL);
26ba25
     printf("%s\n", qstring_get_str(str));
26ba25
-    qobject_decref(obj);
26ba25
+    qobject_unref(obj);
26ba25
     visit_free(v);
26ba25
-    QDECREF(str);
26ba25
+    qobject_unref(str);
26ba25
 }
26ba25
 
26ba25
 static int img_measure(int argc, char **argv)
26ba25
diff --git a/qemu-io.c b/qemu-io.c
26ba25
index e692c55..72fee0d 100644
26ba25
--- a/qemu-io.c
26ba25
+++ b/qemu-io.c
26ba25
@@ -86,7 +86,7 @@ static int openfile(char *name, int flags, bool writethrough, bool force_share,
26ba25
 
26ba25
     if (qemuio_blk) {
26ba25
         error_report("file open already, try 'help close'");
26ba25
-        QDECREF(opts);
26ba25
+        qobject_unref(opts);
26ba25
         return 1;
26ba25
     }
26ba25
 
26ba25
@@ -97,7 +97,7 @@ static int openfile(char *name, int flags, bool writethrough, bool force_share,
26ba25
         if (qdict_haskey(opts, BDRV_OPT_FORCE_SHARE)
26ba25
             && !qdict_get_bool(opts, BDRV_OPT_FORCE_SHARE)) {
26ba25
             error_report("-U conflicts with image options");
26ba25
-            QDECREF(opts);
26ba25
+            qobject_unref(opts);
26ba25
             return 1;
26ba25
         }
26ba25
         qdict_put_bool(opts, BDRV_OPT_FORCE_SHARE, true);
26ba25
@@ -243,7 +243,7 @@ static int open_f(BlockBackend *blk, int argc, char **argv)
26ba25
     } else if (optind == argc) {
26ba25
         openfile(NULL, flags, writethrough, force_share, opts);
26ba25
     } else {
26ba25
-        QDECREF(opts);
26ba25
+        qobject_unref(opts);
26ba25
         qemuio_command_usage(&open_cmd);
26ba25
     }
26ba25
     return 0;
26ba25
diff --git a/qga/main.c b/qga/main.c
26ba25
index df1888e..1e1cec7 100644
26ba25
--- a/qga/main.c
26ba25
+++ b/qga/main.c
26ba25
@@ -563,7 +563,7 @@ static int send_response(GAState *s, QObject *payload)
26ba25
         response_qstr = qstring_new();
26ba25
         qstring_append_chr(response_qstr, QGA_SENTINEL_BYTE);
26ba25
         qstring_append(response_qstr, qstring_get_str(payload_qstr));
26ba25
-        QDECREF(payload_qstr);
26ba25
+        qobject_unref(payload_qstr);
26ba25
     } else {
26ba25
         response_qstr = payload_qstr;
26ba25
     }
26ba25
@@ -571,7 +571,7 @@ static int send_response(GAState *s, QObject *payload)
26ba25
     qstring_append_chr(response_qstr, '\n');
26ba25
     buf = qstring_get_str(response_qstr);
26ba25
     status = ga_channel_write_all(s->channel, buf, strlen(buf));
26ba25
-    QDECREF(response_qstr);
26ba25
+    qobject_unref(response_qstr);
26ba25
     if (status != G_IO_STATUS_NORMAL) {
26ba25
         return -EIO;
26ba25
     }
26ba25
@@ -592,7 +592,7 @@ static void process_command(GAState *s, QDict *req)
26ba25
         if (ret < 0) {
26ba25
             g_warning("error sending response: %s", strerror(-ret));
26ba25
         }
26ba25
-        qobject_decref(rsp);
26ba25
+        qobject_unref(rsp);
26ba25
     }
26ba25
 }
26ba25
 
26ba25
@@ -609,7 +609,7 @@ static void process_event(JSONMessageParser *parser, GQueue *tokens)
26ba25
     g_debug("process_event: called");
26ba25
     qdict = qobject_to(QDict, json_parser_parse_err(tokens, NULL, &err));
26ba25
     if (err || !qdict) {
26ba25
-        QDECREF(qdict);
26ba25
+        qobject_unref(qdict);
26ba25
         qdict = qdict_new();
26ba25
         if (!err) {
26ba25
             g_warning("failed to parse event: unknown error");
26ba25
@@ -626,7 +626,7 @@ static void process_event(JSONMessageParser *parser, GQueue *tokens)
26ba25
         process_command(s, qdict);
26ba25
     } else {
26ba25
         if (!qdict_haskey(qdict, "error")) {
26ba25
-            QDECREF(qdict);
26ba25
+            qobject_unref(qdict);
26ba25
             qdict = qdict_new();
26ba25
             g_warning("unrecognized payload format");
26ba25
             error_setg(&err, QERR_UNSUPPORTED);
26ba25
@@ -639,7 +639,7 @@ static void process_event(JSONMessageParser *parser, GQueue *tokens)
26ba25
         }
26ba25
     }
26ba25
 
26ba25
-    QDECREF(qdict);
26ba25
+    qobject_unref(qdict);
26ba25
 }
26ba25
 
26ba25
 /* false return signals GAChannel to close the current client connection */
26ba25
diff --git a/qmp.c b/qmp.c
26ba25
index f722616..9e95b88 100644
26ba25
--- a/qmp.c
26ba25
+++ b/qmp.c
26ba25
@@ -710,7 +710,7 @@ void qmp_object_add(const char *type, const char *id,
26ba25
             error_setg(errp, QERR_INVALID_PARAMETER_TYPE, "props", "dict");
26ba25
             return;
26ba25
         }
26ba25
-        QINCREF(pdict);
26ba25
+        qobject_ref(pdict);
26ba25
     } else {
26ba25
         pdict = qdict_new();
26ba25
     }
26ba25
@@ -721,7 +721,7 @@ void qmp_object_add(const char *type, const char *id,
26ba25
     if (obj) {
26ba25
         object_unref(obj);
26ba25
     }
26ba25
-    QDECREF(pdict);
26ba25
+    qobject_unref(pdict);
26ba25
 }
26ba25
 
26ba25
 void qmp_object_del(const char *id, Error **errp)
26ba25
diff --git a/qobject/json-parser.c b/qobject/json-parser.c
26ba25
index 769b960..a5aa790 100644
26ba25
--- a/qobject/json-parser.c
26ba25
+++ b/qobject/json-parser.c
26ba25
@@ -222,7 +222,7 @@ static QString *qstring_from_escaped_str(JSONParserContext *ctxt,
26ba25
     return str;
26ba25
 
26ba25
 out:
26ba25
-    QDECREF(str);
26ba25
+    qobject_unref(str);
26ba25
     return NULL;
26ba25
 }
26ba25
 
26ba25
@@ -311,12 +311,12 @@ static int parse_pair(JSONParserContext *ctxt, QDict *dict, va_list *ap)
26ba25
 
26ba25
     qdict_put_obj(dict, qstring_get_str(key), value);
26ba25
 
26ba25
-    QDECREF(key);
26ba25
+    qobject_unref(key);
26ba25
 
26ba25
     return 0;
26ba25
 
26ba25
 out:
26ba25
-    QDECREF(key);
26ba25
+    qobject_unref(key);
26ba25
 
26ba25
     return -1;
26ba25
 }
26ba25
@@ -371,7 +371,7 @@ static QObject *parse_object(JSONParserContext *ctxt, va_list *ap)
26ba25
     return QOBJECT(dict);
26ba25
 
26ba25
 out:
26ba25
-    QDECREF(dict);
26ba25
+    qobject_unref(dict);
26ba25
     return NULL;
26ba25
 }
26ba25
 
26ba25
@@ -435,7 +435,7 @@ static QObject *parse_array(JSONParserContext *ctxt, va_list *ap)
26ba25
     return QOBJECT(list);
26ba25
 
26ba25
 out:
26ba25
-    QDECREF(list);
26ba25
+    qobject_unref(list);
26ba25
     return NULL;
26ba25
 }
26ba25
 
26ba25
diff --git a/qobject/qdict.c b/qobject/qdict.c
26ba25
index d1997a0..2e9bd53 100644
26ba25
--- a/qobject/qdict.c
26ba25
+++ b/qobject/qdict.c
26ba25
@@ -123,7 +123,7 @@ void qdict_put_obj(QDict *qdict, const char *key, QObject *value)
26ba25
     entry = qdict_find(qdict, key, bucket);
26ba25
     if (entry) {
26ba25
         /* replace key's value */
26ba25
-        qobject_decref(entry->value);
26ba25
+        qobject_unref(entry->value);
26ba25
         entry->value = value;
26ba25
     } else {
26ba25
         /* allocate a new entry */
26ba25
@@ -373,7 +373,7 @@ QDict *qdict_clone_shallow(const QDict *src)
26ba25
 
26ba25
     for (i = 0; i < QDICT_BUCKET_MAX; i++) {
26ba25
         QLIST_FOREACH(entry, &src->table[i], next) {
26ba25
-            qobject_incref(entry->value);
26ba25
+            qobject_ref(entry->value);
26ba25
             qdict_put_obj(dest, entry->key, entry->value);
26ba25
         }
26ba25
     }
26ba25
@@ -390,7 +390,7 @@ static void qentry_destroy(QDictEntry *e)
26ba25
     assert(e->key != NULL);
26ba25
     assert(e->value != NULL);
26ba25
 
26ba25
-    qobject_decref(e->value);
26ba25
+    qobject_unref(e->value);
26ba25
     g_free(e->key);
26ba25
     g_free(e);
26ba25
 }
26ba25
@@ -480,7 +480,7 @@ void qdict_copy_default(QDict *dst, QDict *src, const char *key)
26ba25
 
26ba25
     val = qdict_get(src, key);
26ba25
     if (val) {
26ba25
-        qobject_incref(val);
26ba25
+        qobject_ref(val);
26ba25
         qdict_put_obj(dst, key, val);
26ba25
     }
26ba25
 }
26ba25
@@ -526,7 +526,7 @@ static void qdict_flatten_qlist(QList *qlist, QDict *target, const char *prefix)
26ba25
             qdict_flatten_qlist(qobject_to(QList, value), target, new_key);
26ba25
         } else {
26ba25
             /* All other types are moved to the target unchanged. */
26ba25
-            qobject_incref(value);
26ba25
+            qobject_ref(value);
26ba25
             qdict_put_obj(target, new_key, value);
26ba25
         }
26ba25
 
26ba25
@@ -566,7 +566,7 @@ static void qdict_flatten_qdict(QDict *qdict, QDict *target, const char *prefix)
26ba25
             delete = true;
26ba25
         } else if (prefix) {
26ba25
             /* All other objects are moved to the target unchanged. */
26ba25
-            qobject_incref(value);
26ba25
+            qobject_ref(value);
26ba25
             qdict_put_obj(target, new_key, value);
26ba25
             delete = true;
26ba25
         }
26ba25
@@ -610,7 +610,7 @@ void qdict_extract_subqdict(QDict *src, QDict **dst, const char *start)
26ba25
     while (entry != NULL) {
26ba25
         next = qdict_next(src, entry);
26ba25
         if (strstart(entry->key, start, &p)) {
26ba25
-            qobject_incref(entry->value);
26ba25
+            qobject_ref(entry->value);
26ba25
             qdict_put_obj(*dst, p, entry->value);
26ba25
             qdict_del(src, entry->key);
26ba25
         }
26ba25
@@ -684,7 +684,7 @@ void qdict_array_split(QDict *src, QList **dst)
26ba25
             qdict_extract_subqdict(src, &subqdict, prefix);
26ba25
             assert(qdict_size(subqdict) > 0);
26ba25
         } else {
26ba25
-            qobject_incref(subqobj);
26ba25
+            qobject_ref(subqobj);
26ba25
             qdict_del(src, indexstr);
26ba25
         }
26ba25
 
26ba25
@@ -894,7 +894,7 @@ QObject *qdict_crumple(const QDict *src, Error **errp)
26ba25
                 qdict_put_obj(two_level, prefix, QOBJECT(child_dict));
26ba25
             }
26ba25
 
26ba25
-            qobject_incref(ent->value);
26ba25
+            qobject_ref(ent->value);
26ba25
             qdict_put_obj(child_dict, suffix, ent->value);
26ba25
         } else {
26ba25
             if (child) {
26ba25
@@ -902,7 +902,7 @@ QObject *qdict_crumple(const QDict *src, Error **errp)
26ba25
                            prefix);
26ba25
                 goto error;
26ba25
             }
26ba25
-            qobject_incref(ent->value);
26ba25
+            qobject_ref(ent->value);
26ba25
             qdict_put_obj(two_level, prefix, ent->value);
26ba25
         }
26ba25
 
26ba25
@@ -924,11 +924,11 @@ QObject *qdict_crumple(const QDict *src, Error **errp)
26ba25
 
26ba25
             qdict_put_obj(multi_level, ent->key, child);
26ba25
         } else {
26ba25
-            qobject_incref(ent->value);
26ba25
+            qobject_ref(ent->value);
26ba25
             qdict_put_obj(multi_level, ent->key, ent->value);
26ba25
         }
26ba25
     }
26ba25
-    QDECREF(two_level);
26ba25
+    qobject_unref(two_level);
26ba25
     two_level = NULL;
26ba25
 
26ba25
     /* Step 3: detect if we need to turn our dict into list */
26ba25
@@ -951,10 +951,10 @@ QObject *qdict_crumple(const QDict *src, Error **errp)
26ba25
                 goto error;
26ba25
             }
26ba25
 
26ba25
-            qobject_incref(child);
26ba25
+            qobject_ref(child);
26ba25
             qlist_append_obj(qobject_to(QList, dst), child);
26ba25
         }
26ba25
-        QDECREF(multi_level);
26ba25
+        qobject_unref(multi_level);
26ba25
         multi_level = NULL;
26ba25
     } else {
26ba25
         dst = QOBJECT(multi_level);
26ba25
@@ -964,9 +964,9 @@ QObject *qdict_crumple(const QDict *src, Error **errp)
26ba25
 
26ba25
  error:
26ba25
     g_free(prefix);
26ba25
-    QDECREF(multi_level);
26ba25
-    QDECREF(two_level);
26ba25
-    qobject_decref(dst);
26ba25
+    qobject_unref(multi_level);
26ba25
+    qobject_unref(two_level);
26ba25
+    qobject_unref(dst);
26ba25
     return NULL;
26ba25
 }
26ba25
 
26ba25
@@ -1055,7 +1055,7 @@ void qdict_join(QDict *dest, QDict *src, bool overwrite)
26ba25
         next = qdict_next(src, entry);
26ba25
 
26ba25
         if (overwrite || !qdict_haskey(dest, entry->key)) {
26ba25
-            qobject_incref(entry->value);
26ba25
+            qobject_ref(entry->value);
26ba25
             qdict_put_obj(dest, entry->key, entry->value);
26ba25
             qdict_del(src, entry->key);
26ba25
         }
26ba25
@@ -1088,7 +1088,7 @@ bool qdict_rename_keys(QDict *qdict, const QDictRenames *renames, Error **errp)
26ba25
             }
26ba25
 
26ba25
             qobj = qdict_get(qdict, renames->from);
26ba25
-            qobject_incref(qobj);
26ba25
+            qobject_ref(qobj);
26ba25
             qdict_put_obj(qdict, renames->to, qobj);
26ba25
             qdict_del(qdict, renames->from);
26ba25
         }
26ba25
diff --git a/qobject/qjson.c b/qobject/qjson.c
26ba25
index 655d38a..9816a65 100644
26ba25
--- a/qobject/qjson.c
26ba25
+++ b/qobject/qjson.c
26ba25
@@ -104,7 +104,7 @@ static void to_json_dict_iter(const char *key, QObject *obj, void *opaque)
26ba25
 
26ba25
     qkey = qstring_from_str(key);
26ba25
     to_json(QOBJECT(qkey), s->str, s->pretty, s->indent);
26ba25
-    QDECREF(qkey);
26ba25
+    qobject_unref(qkey);
26ba25
 
26ba25
     qstring_append(s->str, ": ");
26ba25
     to_json(obj, s->str, s->pretty, s->indent);
26ba25
diff --git a/qobject/qlist.c b/qobject/qlist.c
26ba25
index 954fe98..37c1c16 100644
26ba25
--- a/qobject/qlist.c
26ba25
+++ b/qobject/qlist.c
26ba25
@@ -39,7 +39,7 @@ static void qlist_copy_elem(QObject *obj, void *opaque)
26ba25
 {
26ba25
     QList *dst = opaque;
26ba25
 
26ba25
-    qobject_incref(obj);
26ba25
+    qobject_ref(obj);
26ba25
     qlist_append_obj(dst, obj);
26ba25
 }
26ba25
 
26ba25
@@ -196,7 +196,7 @@ void qlist_destroy_obj(QObject *obj)
26ba25
 
26ba25
     QTAILQ_FOREACH_SAFE(entry, &qlist->head, next, next_entry) {
26ba25
         QTAILQ_REMOVE(&qlist->head, entry, next);
26ba25
-        qobject_decref(entry->value);
26ba25
+        qobject_unref(entry->value);
26ba25
         g_free(entry);
26ba25
     }
26ba25
 
26ba25
diff --git a/qom/object.c b/qom/object.c
26ba25
index 4677951..76a89af 100644
26ba25
--- a/qom/object.c
26ba25
+++ b/qom/object.c
26ba25
@@ -1129,7 +1129,7 @@ void object_property_set_str(Object *obj, const char *value,
26ba25
     QString *qstr = qstring_from_str(value);
26ba25
     object_property_set_qobject(obj, QOBJECT(qstr), name, errp);
26ba25
 
26ba25
-    QDECREF(qstr);
26ba25
+    qobject_unref(qstr);
26ba25
 }
26ba25
 
26ba25
 char *object_property_get_str(Object *obj, const char *name,
26ba25
@@ -1147,7 +1147,7 @@ char *object_property_get_str(Object *obj, const char *name,
26ba25
         error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "string");
26ba25
     }
26ba25
 
26ba25
-    qobject_decref(ret);
26ba25
+    qobject_unref(ret);
26ba25
     return retval;
26ba25
 }
26ba25
 
26ba25
@@ -1187,7 +1187,7 @@ void object_property_set_bool(Object *obj, bool value,
26ba25
     QBool *qbool = qbool_from_bool(value);
26ba25
     object_property_set_qobject(obj, QOBJECT(qbool), name, errp);
26ba25
 
26ba25
-    QDECREF(qbool);
26ba25
+    qobject_unref(qbool);
26ba25
 }
26ba25
 
26ba25
 bool object_property_get_bool(Object *obj, const char *name,
26ba25
@@ -1208,7 +1208,7 @@ bool object_property_get_bool(Object *obj, const char *name,
26ba25
         retval = qbool_get_bool(qbool);
26ba25
     }
26ba25
 
26ba25
-    qobject_decref(ret);
26ba25
+    qobject_unref(ret);
26ba25
     return retval;
26ba25
 }
26ba25
 
26ba25
@@ -1218,7 +1218,7 @@ void object_property_set_int(Object *obj, int64_t value,
26ba25
     QNum *qnum = qnum_from_int(value);
26ba25
     object_property_set_qobject(obj, QOBJECT(qnum), name, errp);
26ba25
 
26ba25
-    QDECREF(qnum);
26ba25
+    qobject_unref(qnum);
26ba25
 }
26ba25
 
26ba25
 int64_t object_property_get_int(Object *obj, const char *name,
26ba25
@@ -1238,7 +1238,7 @@ int64_t object_property_get_int(Object *obj, const char *name,
26ba25
         retval = -1;
26ba25
     }
26ba25
 
26ba25
-    qobject_decref(ret);
26ba25
+    qobject_unref(ret);
26ba25
     return retval;
26ba25
 }
26ba25
 
26ba25
@@ -1248,7 +1248,7 @@ void object_property_set_uint(Object *obj, uint64_t value,
26ba25
     QNum *qnum = qnum_from_uint(value);
26ba25
 
26ba25
     object_property_set_qobject(obj, QOBJECT(qnum), name, errp);
26ba25
-    QDECREF(qnum);
26ba25
+    qobject_unref(qnum);
26ba25
 }
26ba25
 
26ba25