summaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-04-19 17:01:44 +0200
committerMarkus Armbruster <armbru@redhat.com>2018-05-04 08:27:53 +0200
commitf5a74a5a50387c6f980b2e2f94f062487a1826da (patch)
treeeefbe4d2f8bb0f889c9643d140fd702f131c4fd0 /block.c
parentcb3e7f08aeaab0ab13e629ce8496dca150a449ba (diff)
downloadqemu-f5a74a5a50387c6f980b2e2f94f062487a1826da.tar.gz
qobject: Modify qobject_ref() to return obj
For convenience and clarity, make it possible to call qobject_ref() at the time when the reference is associated with a variable, or argument, by making qobject_ref() return the same pointer as given. Use that to simplify the callers. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180419150145.24795-5-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Useless change to qobject_ref_impl() dropped, commit message improved slightly] Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/block.c b/block.c
index 55a79845be..676e57f562 100644
--- a/block.c
+++ b/block.c
@@ -5134,8 +5134,8 @@ static bool append_open_options(QDict *d, BlockDriverState *bs)
continue;
}
- qobject_ref(qdict_entry_value(entry));
- qdict_put_obj(d, qdict_entry_key(entry), qdict_entry_value(entry));
+ qdict_put_obj(d, qdict_entry_key(entry),
+ qobject_ref(qdict_entry_value(entry)));
found_any = true;
}
@@ -5207,8 +5207,8 @@ void bdrv_refresh_filename(BlockDriverState *bs)
* suffices without querying the (exact_)filename of this BDS. */
if (bs->file->bs->full_open_options) {
qdict_put_str(opts, "driver", drv->format_name);
- qobject_ref(bs->file->bs->full_open_options);
- qdict_put(opts, "file", bs->file->bs->full_open_options);
+ qdict_put(opts, "file",
+ qobject_ref(bs->file->bs->full_open_options));
bs->full_open_options = opts;
} else {