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