|
|
ae23c9 |
From 6dc6db930a9906faa26dc8c4e89d4b356dbaaa58 Mon Sep 17 00:00:00 2001
|
|
|
ae23c9 |
From: Markus Armbruster <armbru@redhat.com>
|
|
|
ae23c9 |
Date: Mon, 18 Jun 2018 08:43:12 +0200
|
|
|
ae23c9 |
Subject: [PATCH 014/268] qobject: Modify qobject_ref() to return obj
|
|
|
ae23c9 |
MIME-Version: 1.0
|
|
|
ae23c9 |
Content-Type: text/plain; charset=UTF-8
|
|
|
ae23c9 |
Content-Transfer-Encoding: 8bit
|
|
|
ae23c9 |
|
|
|
ae23c9 |
RH-Author: Markus Armbruster <armbru@redhat.com>
|
|
|
ae23c9 |
Message-id: <20180618084330.30009-6-armbru@redhat.com>
|
|
|
ae23c9 |
Patchwork-id: 80738
|
|
|
ae23c9 |
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 05/23] qobject: Modify qobject_ref() to return obj
|
|
|
ae23c9 |
Bugzilla: 1557995
|
|
|
ae23c9 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
For convenience and clarity, make it possible to call qobject_ref() at
|
|
|
ae23c9 |
the time when the reference is associated with a variable, or
|
|
|
ae23c9 |
argument, by making qobject_ref() return the same pointer as given.
|
|
|
ae23c9 |
Use that to simplify the callers.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
ae23c9 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
ae23c9 |
Message-Id: <20180419150145.24795-5-marcandre.lureau@redhat.com>
|
|
|
ae23c9 |
Reviewed-by: Markus Armbruster <armbru@redhat.com>
|
|
|
ae23c9 |
[Useless change to qobject_ref_impl() dropped, commit message improved
|
|
|
ae23c9 |
slightly]
|
|
|
ae23c9 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
ae23c9 |
(cherry picked from commit f5a74a5a50387c6f980b2e2f94f062487a1826da)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ae23c9 |
---
|
|
|
ae23c9 |
block.c | 8 ++++----
|
|
|
ae23c9 |
block/blkdebug.c | 7 +++----
|
|
|
ae23c9 |
block/blkverify.c | 8 ++++----
|
|
|
ae23c9 |
block/null.c | 3 +--
|
|
|
ae23c9 |
block/nvme.c | 3 +--
|
|
|
ae23c9 |
block/quorum.c | 4 ++--
|
|
|
ae23c9 |
include/qapi/qmp/qnull.h | 3 +--
|
|
|
ae23c9 |
include/qapi/qmp/qobject.h | 9 ++++++++-
|
|
|
ae23c9 |
monitor.c | 20 +++++++-------------
|
|
|
ae23c9 |
qapi/qobject-input-visitor.c | 6 ++----
|
|
|
ae23c9 |
qapi/qobject-output-visitor.c | 7 +++----
|
|
|
ae23c9 |
qobject/qdict.c | 33 +++++++++++----------------------
|
|
|
ae23c9 |
12 files changed, 47 insertions(+), 64 deletions(-)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/block.c b/block.c
|
|
|
ae23c9 |
index 55a7984..676e57f 100644
|
|
|
ae23c9 |
--- a/block.c
|
|
|
ae23c9 |
+++ b/block.c
|
|
|
ae23c9 |
@@ -5134,8 +5134,8 @@ static bool append_open_options(QDict *d, BlockDriverState *bs)
|
|
|
ae23c9 |
continue;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- qobject_ref(qdict_entry_value(entry));
|
|
|
ae23c9 |
- qdict_put_obj(d, qdict_entry_key(entry), qdict_entry_value(entry));
|
|
|
ae23c9 |
+ qdict_put_obj(d, qdict_entry_key(entry),
|
|
|
ae23c9 |
+ qobject_ref(qdict_entry_value(entry)));
|
|
|
ae23c9 |
found_any = true;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
@@ -5207,8 +5207,8 @@ void bdrv_refresh_filename(BlockDriverState *bs)
|
|
|
ae23c9 |
* suffices without querying the (exact_)filename of this BDS. */
|
|
|
ae23c9 |
if (bs->file->bs->full_open_options) {
|
|
|
ae23c9 |
qdict_put_str(opts, "driver", drv->format_name);
|
|
|
ae23c9 |
- qobject_ref(bs->file->bs->full_open_options);
|
|
|
ae23c9 |
- qdict_put(opts, "file", bs->file->bs->full_open_options);
|
|
|
ae23c9 |
+ qdict_put(opts, "file",
|
|
|
ae23c9 |
+ qobject_ref(bs->file->bs->full_open_options));
|
|
|
ae23c9 |
|
|
|
ae23c9 |
bs->full_open_options = opts;
|
|
|
ae23c9 |
} else {
|
|
|
ae23c9 |
diff --git a/block/blkdebug.c b/block/blkdebug.c
|
|
|
ae23c9 |
index 689703d..053372c 100644
|
|
|
ae23c9 |
--- a/block/blkdebug.c
|
|
|
ae23c9 |
+++ b/block/blkdebug.c
|
|
|
ae23c9 |
@@ -845,13 +845,12 @@ static void blkdebug_refresh_filename(BlockDriverState *bs, QDict *options)
|
|
|
ae23c9 |
opts = qdict_new();
|
|
|
ae23c9 |
qdict_put_str(opts, "driver", "blkdebug");
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- qobject_ref(bs->file->bs->full_open_options);
|
|
|
ae23c9 |
- qdict_put(opts, "image", bs->file->bs->full_open_options);
|
|
|
ae23c9 |
+ qdict_put(opts, "image", qobject_ref(bs->file->bs->full_open_options));
|
|
|
ae23c9 |
|
|
|
ae23c9 |
for (e = qdict_first(options); e; e = qdict_next(options, e)) {
|
|
|
ae23c9 |
if (strcmp(qdict_entry_key(e), "x-image")) {
|
|
|
ae23c9 |
- qobject_ref(qdict_entry_value(e));
|
|
|
ae23c9 |
- qdict_put_obj(opts, qdict_entry_key(e), qdict_entry_value(e));
|
|
|
ae23c9 |
+ qdict_put_obj(opts, qdict_entry_key(e),
|
|
|
ae23c9 |
+ qobject_ref(qdict_entry_value(e)));
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/block/blkverify.c b/block/blkverify.c
|
|
|
ae23c9 |
index 3cffcb1..754cc9e 100644
|
|
|
ae23c9 |
--- a/block/blkverify.c
|
|
|
ae23c9 |
+++ b/block/blkverify.c
|
|
|
ae23c9 |
@@ -291,10 +291,10 @@ static void blkverify_refresh_filename(BlockDriverState *bs, QDict *options)
|
|
|
ae23c9 |
QDict *opts = qdict_new();
|
|
|
ae23c9 |
qdict_put_str(opts, "driver", "blkverify");
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- qobject_ref(bs->file->bs->full_open_options);
|
|
|
ae23c9 |
- qdict_put(opts, "raw", bs->file->bs->full_open_options);
|
|
|
ae23c9 |
- qobject_ref(s->test_file->bs->full_open_options);
|
|
|
ae23c9 |
- qdict_put(opts, "test", s->test_file->bs->full_open_options);
|
|
|
ae23c9 |
+ qdict_put(opts, "raw",
|
|
|
ae23c9 |
+ qobject_ref(bs->file->bs->full_open_options));
|
|
|
ae23c9 |
+ qdict_put(opts, "test",
|
|
|
ae23c9 |
+ qobject_ref(s->test_file->bs->full_open_options));
|
|
|
ae23c9 |
|
|
|
ae23c9 |
bs->full_open_options = opts;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
diff --git a/block/null.c b/block/null.c
|
|
|
ae23c9 |
index 700a2d0..3944550 100644
|
|
|
ae23c9 |
--- a/block/null.c
|
|
|
ae23c9 |
+++ b/block/null.c
|
|
|
ae23c9 |
@@ -244,7 +244,6 @@ static int coroutine_fn null_co_block_status(BlockDriverState *bs,
|
|
|
ae23c9 |
|
|
|
ae23c9 |
static void null_refresh_filename(BlockDriverState *bs, QDict *opts)
|
|
|
ae23c9 |
{
|
|
|
ae23c9 |
- qobject_ref(opts);
|
|
|
ae23c9 |
qdict_del(opts, "filename");
|
|
|
ae23c9 |
|
|
|
ae23c9 |
if (!qdict_size(opts)) {
|
|
|
ae23c9 |
@@ -253,7 +252,7 @@ static void null_refresh_filename(BlockDriverState *bs, QDict *opts)
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
qdict_put_str(opts, "driver", bs->drv->format_name);
|
|
|
ae23c9 |
- bs->full_open_options = opts;
|
|
|
ae23c9 |
+ bs->full_open_options = qobject_ref(opts);
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
static BlockDriver bdrv_null_co = {
|
|
|
ae23c9 |
diff --git a/block/nvme.c b/block/nvme.c
|
|
|
ae23c9 |
index e192da9..6f71122 100644
|
|
|
ae23c9 |
--- a/block/nvme.c
|
|
|
ae23c9 |
+++ b/block/nvme.c
|
|
|
ae23c9 |
@@ -1073,7 +1073,6 @@ static int nvme_reopen_prepare(BDRVReopenState *reopen_state,
|
|
|
ae23c9 |
|
|
|
ae23c9 |
static void nvme_refresh_filename(BlockDriverState *bs, QDict *opts)
|
|
|
ae23c9 |
{
|
|
|
ae23c9 |
- qobject_ref(opts);
|
|
|
ae23c9 |
qdict_del(opts, "filename");
|
|
|
ae23c9 |
|
|
|
ae23c9 |
if (!qdict_size(opts)) {
|
|
|
ae23c9 |
@@ -1082,7 +1081,7 @@ static void nvme_refresh_filename(BlockDriverState *bs, QDict *opts)
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
qdict_put_str(opts, "driver", bs->drv->format_name);
|
|
|
ae23c9 |
- bs->full_open_options = opts;
|
|
|
ae23c9 |
+ bs->full_open_options = qobject_ref(opts);
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
static void nvme_refresh_limits(BlockDriverState *bs, Error **errp)
|
|
|
ae23c9 |
diff --git a/block/quorum.c b/block/quorum.c
|
|
|
ae23c9 |
index 862cea3..a5051da 100644
|
|
|
ae23c9 |
--- a/block/quorum.c
|
|
|
ae23c9 |
+++ b/block/quorum.c
|
|
|
ae23c9 |
@@ -1082,8 +1082,8 @@ static void quorum_refresh_filename(BlockDriverState *bs, QDict *options)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
children = qlist_new();
|
|
|
ae23c9 |
for (i = 0; i < s->num_children; i++) {
|
|
|
ae23c9 |
- qobject_ref(s->children[i]->bs->full_open_options);
|
|
|
ae23c9 |
- qlist_append(children, s->children[i]->bs->full_open_options);
|
|
|
ae23c9 |
+ qlist_append(children,
|
|
|
ae23c9 |
+ qobject_ref(s->children[i]->bs->full_open_options));
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
opts = qdict_new();
|
|
|
ae23c9 |
diff --git a/include/qapi/qmp/qnull.h b/include/qapi/qmp/qnull.h
|
|
|
ae23c9 |
index 75b29c6..c142688 100644
|
|
|
ae23c9 |
--- a/include/qapi/qmp/qnull.h
|
|
|
ae23c9 |
+++ b/include/qapi/qmp/qnull.h
|
|
|
ae23c9 |
@@ -23,8 +23,7 @@ extern QNull qnull_;
|
|
|
ae23c9 |
|
|
|
ae23c9 |
static inline QNull *qnull(void)
|
|
|
ae23c9 |
{
|
|
|
ae23c9 |
- qobject_ref(&qnull_);
|
|
|
ae23c9 |
- return &qnull_;
|
|
|
ae23c9 |
+ return qobject_ref(&qnull_);
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
bool qnull_is_equal(const QObject *x, const QObject *y);
|
|
|
ae23c9 |
diff --git a/include/qapi/qmp/qobject.h b/include/qapi/qmp/qobject.h
|
|
|
ae23c9 |
index e20006f..fcfd549 100644
|
|
|
ae23c9 |
--- a/include/qapi/qmp/qobject.h
|
|
|
ae23c9 |
+++ b/include/qapi/qmp/qobject.h
|
|
|
ae23c9 |
@@ -103,8 +103,15 @@ static inline void qobject_unref_impl(QObject *obj)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
/**
|
|
|
ae23c9 |
* qobject_ref(): Increment QObject's reference count
|
|
|
ae23c9 |
+ *
|
|
|
ae23c9 |
+ * Returns: the same @obj. The type of @obj will be propagated to the
|
|
|
ae23c9 |
+ * return type.
|
|
|
ae23c9 |
*/
|
|
|
ae23c9 |
-#define qobject_ref(obj) qobject_ref_impl(QOBJECT(obj))
|
|
|
ae23c9 |
+#define qobject_ref(obj) ({ \
|
|
|
ae23c9 |
+ typeof(obj) _o = (obj); \
|
|
|
ae23c9 |
+ qobject_ref_impl(QOBJECT(_o)); \
|
|
|
ae23c9 |
+ _o; \
|
|
|
ae23c9 |
+})
|
|
|
ae23c9 |
|
|
|
ae23c9 |
/**
|
|
|
ae23c9 |
* qobject_unref(): Decrement QObject's reference count, deallocate
|
|
|
ae23c9 |
diff --git a/monitor.c b/monitor.c
|
|
|
ae23c9 |
index 4f43eee..46814af 100644
|
|
|
ae23c9 |
--- a/monitor.c
|
|
|
ae23c9 |
+++ b/monitor.c
|
|
|
ae23c9 |
@@ -494,9 +494,8 @@ static void monitor_json_emitter(Monitor *mon, QObject *data)
|
|
|
ae23c9 |
* caller won't free the data (which will be finally freed in
|
|
|
ae23c9 |
* responder thread).
|
|
|
ae23c9 |
*/
|
|
|
ae23c9 |
- qobject_ref(data);
|
|
|
ae23c9 |
qemu_mutex_lock(&mon->qmp.qmp_queue_lock);
|
|
|
ae23c9 |
- g_queue_push_tail(mon->qmp.qmp_responses, data);
|
|
|
ae23c9 |
+ g_queue_push_tail(mon->qmp.qmp_responses, qobject_ref(data));
|
|
|
ae23c9 |
qemu_mutex_unlock(&mon->qmp.qmp_queue_lock);
|
|
|
ae23c9 |
qemu_bh_schedule(mon_global.qmp_respond_bh);
|
|
|
ae23c9 |
} else {
|
|
|
ae23c9 |
@@ -614,8 +613,7 @@ monitor_qapi_event_queue(QAPIEvent event, QDict *qdict, Error **errp)
|
|
|
ae23c9 |
* replacing a prior stored event if any.
|
|
|
ae23c9 |
*/
|
|
|
ae23c9 |
qobject_unref(evstate->qdict);
|
|
|
ae23c9 |
- evstate->qdict = qdict;
|
|
|
ae23c9 |
- qobject_ref(evstate->qdict);
|
|
|
ae23c9 |
+ evstate->qdict = qobject_ref(qdict);
|
|
|
ae23c9 |
} else {
|
|
|
ae23c9 |
/*
|
|
|
ae23c9 |
* Last send was (at least) evconf->rate ns ago.
|
|
|
ae23c9 |
@@ -629,8 +627,7 @@ monitor_qapi_event_queue(QAPIEvent event, QDict *qdict, Error **errp)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
evstate = g_new(MonitorQAPIEventState, 1);
|
|
|
ae23c9 |
evstate->event = event;
|
|
|
ae23c9 |
- evstate->data = data;
|
|
|
ae23c9 |
- qobject_ref(evstate->data);
|
|
|
ae23c9 |
+ evstate->data = qobject_ref(data);
|
|
|
ae23c9 |
evstate->qdict = NULL;
|
|
|
ae23c9 |
evstate->timer = timer_new_ns(event_clock_type,
|
|
|
ae23c9 |
monitor_qapi_event_handler,
|
|
|
ae23c9 |
@@ -4048,9 +4045,7 @@ static void monitor_qmp_respond(Monitor *mon, QObject *rsp,
|
|
|
ae23c9 |
|
|
|
ae23c9 |
if (rsp) {
|
|
|
ae23c9 |
if (id) {
|
|
|
ae23c9 |
- /* This is for the qdict below. */
|
|
|
ae23c9 |
- qobject_ref(id);
|
|
|
ae23c9 |
- qdict_put_obj(qobject_to(QDict, rsp), "id", id);
|
|
|
ae23c9 |
+ qdict_put_obj(qobject_to(QDict, rsp), "id", qobject_ref(id));
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
monitor_json_emitter(mon, rsp);
|
|
|
ae23c9 |
@@ -4190,15 +4185,14 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
|
|
|
ae23c9 |
goto err;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- qobject_ref(id);
|
|
|
ae23c9 |
- qdict_del(qdict, "id");
|
|
|
ae23c9 |
-
|
|
|
ae23c9 |
req_obj = g_new0(QMPRequest, 1);
|
|
|
ae23c9 |
req_obj->mon = mon;
|
|
|
ae23c9 |
- req_obj->id = id;
|
|
|
ae23c9 |
+ req_obj->id = qobject_ref(id);
|
|
|
ae23c9 |
req_obj->req = req;
|
|
|
ae23c9 |
req_obj->need_resume = false;
|
|
|
ae23c9 |
|
|
|
ae23c9 |
+ qdict_del(qdict, "id");
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
if (qmp_is_oob(qdict)) {
|
|
|
ae23c9 |
/* Out-Of-Band (OOB) requests are executed directly in parser. */
|
|
|
ae23c9 |
trace_monitor_qmp_cmd_out_of_band(qobject_get_try_str(req_obj->id)
|
|
|
ae23c9 |
diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c
|
|
|
ae23c9 |
index 7a290c4..da57f4c 100644
|
|
|
ae23c9 |
--- a/qapi/qobject-input-visitor.c
|
|
|
ae23c9 |
+++ b/qapi/qobject-input-visitor.c
|
|
|
ae23c9 |
@@ -588,8 +588,7 @@ static void qobject_input_type_any(Visitor *v, const char *name, QObject **obj,
|
|
|
ae23c9 |
return;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- qobject_ref(qobj);
|
|
|
ae23c9 |
- *obj = qobj;
|
|
|
ae23c9 |
+ *obj = qobject_ref(qobj);
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
static void qobject_input_type_null(Visitor *v, const char *name,
|
|
|
ae23c9 |
@@ -677,8 +676,7 @@ static QObjectInputVisitor *qobject_input_visitor_base_new(QObject *obj)
|
|
|
ae23c9 |
v->visitor.optional = qobject_input_optional;
|
|
|
ae23c9 |
v->visitor.free = qobject_input_free;
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- v->root = obj;
|
|
|
ae23c9 |
- qobject_ref(obj);
|
|
|
ae23c9 |
+ v->root = qobject_ref(obj);
|
|
|
ae23c9 |
|
|
|
ae23c9 |
return v;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
diff --git a/qapi/qobject-output-visitor.c b/qapi/qobject-output-visitor.c
|
|
|
ae23c9 |
index 3a933b4..89ffd8a 100644
|
|
|
ae23c9 |
--- a/qapi/qobject-output-visitor.c
|
|
|
ae23c9 |
+++ b/qapi/qobject-output-visitor.c
|
|
|
ae23c9 |
@@ -188,8 +188,8 @@ static void qobject_output_type_any(Visitor *v, const char *name,
|
|
|
ae23c9 |
QObject **obj, Error **errp)
|
|
|
ae23c9 |
{
|
|
|
ae23c9 |
QObjectOutputVisitor *qov = to_qov(v);
|
|
|
ae23c9 |
- qobject_ref(*obj);
|
|
|
ae23c9 |
- qobject_output_add_obj(qov, name, *obj);
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+ qobject_output_add_obj(qov, name, qobject_ref(*obj));
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
static void qobject_output_type_null(Visitor *v, const char *name,
|
|
|
ae23c9 |
@@ -210,8 +210,7 @@ static void qobject_output_complete(Visitor *v, void *opaque)
|
|
|
ae23c9 |
assert(qov->root && QSLIST_EMPTY(&qov->stack));
|
|
|
ae23c9 |
assert(opaque == qov->result);
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- qobject_ref(qov->root);
|
|
|
ae23c9 |
- *qov->result = qov->root;
|
|
|
ae23c9 |
+ *qov->result = qobject_ref(qov->root);
|
|
|
ae23c9 |
qov->result = NULL;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/qobject/qdict.c b/qobject/qdict.c
|
|
|
ae23c9 |
index 2e9bd53..22800ee 100644
|
|
|
ae23c9 |
--- a/qobject/qdict.c
|
|
|
ae23c9 |
+++ b/qobject/qdict.c
|
|
|
ae23c9 |
@@ -373,8 +373,7 @@ QDict *qdict_clone_shallow(const QDict *src)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
for (i = 0; i < QDICT_BUCKET_MAX; i++) {
|
|
|
ae23c9 |
QLIST_FOREACH(entry, &src->table[i], next) {
|
|
|
ae23c9 |
- qobject_ref(entry->value);
|
|
|
ae23c9 |
- qdict_put_obj(dest, entry->key, entry->value);
|
|
|
ae23c9 |
+ qdict_put_obj(dest, entry->key, qobject_ref(entry->value));
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
@@ -480,8 +479,7 @@ void qdict_copy_default(QDict *dst, QDict *src, const char *key)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
val = qdict_get(src, key);
|
|
|
ae23c9 |
if (val) {
|
|
|
ae23c9 |
- qobject_ref(val);
|
|
|
ae23c9 |
- qdict_put_obj(dst, key, val);
|
|
|
ae23c9 |
+ qdict_put_obj(dst, key, qobject_ref(val));
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
@@ -526,8 +524,7 @@ static void qdict_flatten_qlist(QList *qlist, QDict *target, const char *prefix)
|
|
|
ae23c9 |
qdict_flatten_qlist(qobject_to(QList, value), target, new_key);
|
|
|
ae23c9 |
} else {
|
|
|
ae23c9 |
/* All other types are moved to the target unchanged. */
|
|
|
ae23c9 |
- qobject_ref(value);
|
|
|
ae23c9 |
- qdict_put_obj(target, new_key, value);
|
|
|
ae23c9 |
+ qdict_put_obj(target, new_key, qobject_ref(value));
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
g_free(new_key);
|
|
|
ae23c9 |
@@ -566,8 +563,7 @@ static void qdict_flatten_qdict(QDict *qdict, QDict *target, const char *prefix)
|
|
|
ae23c9 |
delete = true;
|
|
|
ae23c9 |
} else if (prefix) {
|
|
|
ae23c9 |
/* All other objects are moved to the target unchanged. */
|
|
|
ae23c9 |
- qobject_ref(value);
|
|
|
ae23c9 |
- qdict_put_obj(target, new_key, value);
|
|
|
ae23c9 |
+ qdict_put_obj(target, new_key, qobject_ref(value));
|
|
|
ae23c9 |
delete = true;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
@@ -610,8 +606,7 @@ void qdict_extract_subqdict(QDict *src, QDict **dst, const char *start)
|
|
|
ae23c9 |
while (entry != NULL) {
|
|
|
ae23c9 |
next = qdict_next(src, entry);
|
|
|
ae23c9 |
if (strstart(entry->key, start, &p)) {
|
|
|
ae23c9 |
- qobject_ref(entry->value);
|
|
|
ae23c9 |
- qdict_put_obj(*dst, p, entry->value);
|
|
|
ae23c9 |
+ qdict_put_obj(*dst, p, qobject_ref(entry->value));
|
|
|
ae23c9 |
qdict_del(src, entry->key);
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
entry = next;
|
|
|
ae23c9 |
@@ -894,16 +889,14 @@ QObject *qdict_crumple(const QDict *src, Error **errp)
|
|
|
ae23c9 |
qdict_put_obj(two_level, prefix, QOBJECT(child_dict));
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- qobject_ref(ent->value);
|
|
|
ae23c9 |
- qdict_put_obj(child_dict, suffix, ent->value);
|
|
|
ae23c9 |
+ qdict_put_obj(child_dict, suffix, qobject_ref(ent->value));
|
|
|
ae23c9 |
} else {
|
|
|
ae23c9 |
if (child) {
|
|
|
ae23c9 |
error_setg(errp, "Key %s prefix is already set as a dict",
|
|
|
ae23c9 |
prefix);
|
|
|
ae23c9 |
goto error;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
- qobject_ref(ent->value);
|
|
|
ae23c9 |
- qdict_put_obj(two_level, prefix, ent->value);
|
|
|
ae23c9 |
+ qdict_put_obj(two_level, prefix, qobject_ref(ent->value));
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
g_free(prefix);
|
|
|
ae23c9 |
@@ -924,8 +917,7 @@ QObject *qdict_crumple(const QDict *src, Error **errp)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
qdict_put_obj(multi_level, ent->key, child);
|
|
|
ae23c9 |
} else {
|
|
|
ae23c9 |
- qobject_ref(ent->value);
|
|
|
ae23c9 |
- qdict_put_obj(multi_level, ent->key, ent->value);
|
|
|
ae23c9 |
+ qdict_put_obj(multi_level, ent->key, qobject_ref(ent->value));
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
qobject_unref(two_level);
|
|
|
ae23c9 |
@@ -951,8 +943,7 @@ QObject *qdict_crumple(const QDict *src, Error **errp)
|
|
|
ae23c9 |
goto error;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- qobject_ref(child);
|
|
|
ae23c9 |
- qlist_append_obj(qobject_to(QList, dst), child);
|
|
|
ae23c9 |
+ qlist_append_obj(qobject_to(QList, dst), qobject_ref(child));
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
qobject_unref(multi_level);
|
|
|
ae23c9 |
multi_level = NULL;
|
|
|
ae23c9 |
@@ -1055,8 +1046,7 @@ void qdict_join(QDict *dest, QDict *src, bool overwrite)
|
|
|
ae23c9 |
next = qdict_next(src, entry);
|
|
|
ae23c9 |
|
|
|
ae23c9 |
if (overwrite || !qdict_haskey(dest, entry->key)) {
|
|
|
ae23c9 |
- qobject_ref(entry->value);
|
|
|
ae23c9 |
- qdict_put_obj(dest, entry->key, entry->value);
|
|
|
ae23c9 |
+ qdict_put_obj(dest, entry->key, qobject_ref(entry->value));
|
|
|
ae23c9 |
qdict_del(src, entry->key);
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
@@ -1088,8 +1078,7 @@ bool qdict_rename_keys(QDict *qdict, const QDictRenames *renames, Error **errp)
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
qobj = qdict_get(qdict, renames->from);
|
|
|
ae23c9 |
- qobject_ref(qobj);
|
|
|
ae23c9 |
- qdict_put_obj(qdict, renames->to, qobj);
|
|
|
ae23c9 |
+ qdict_put_obj(qdict, renames->to, qobject_ref(qobj));
|
|
|
ae23c9 |
qdict_del(qdict, renames->from);
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
--
|
|
|
ae23c9 |
1.8.3.1
|
|
|
ae23c9 |
|