aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2017-04-27 16:58:15 -0500
committerMarkus Armbruster <armbru@redhat.com>2017-05-08 20:32:14 +0200
commitde6e7951fe66053dfeaac1a237f7aceb9e079619 (patch)
treeced0a9dc4f2798e16b0f773318de92683c39fdb6 /block
parenta2f3453ebc64b1ebe094aeaf83f9e67896f90ac3 (diff)
qobject: Drop useless QObject casts
We have macros in place to make it less verbose to add a subtype of QObject to both QDict and QList. While we have made cleanups like this in the past (see commit fcfcd8ffc, for example), having it be automated by Coccinelle makes it easier to maintain. Patch created mechanically via: spatch --sp-file scripts/coccinelle/qobject.cocci \ --macro-file scripts/cocci-macro-file.h --dir . --in-place then I verified that no manual touchups were required. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20170427215821.19397-5-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/blkdebug.c4
-rw-r--r--block/blkverify.c7
-rw-r--r--block/file-posix.c6
-rw-r--r--block/file-win32.c4
-rw-r--r--block/quorum.c16
5 files changed, 16 insertions, 21 deletions
diff --git a/block/blkdebug.c b/block/blkdebug.c
index d2a7561c4c..16322d83dd 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -693,10 +693,10 @@ static void blkdebug_refresh_filename(BlockDriverState *bs, QDict *options)
}
opts = qdict_new();
- qdict_put_obj(opts, "driver", QOBJECT(qstring_from_str("blkdebug")));
+ qdict_put(opts, "driver", qstring_from_str("blkdebug"));
QINCREF(bs->file->bs->full_open_options);
- qdict_put_obj(opts, "image", QOBJECT(bs->file->bs->full_open_options));
+ qdict_put(opts, "image", bs->file->bs->full_open_options);
for (e = qdict_first(options); e; e = qdict_next(options, e)) {
if (strcmp(qdict_entry_key(e), "x-image")) {
diff --git a/block/blkverify.c b/block/blkverify.c
index af23281669..cc29cd2b54 100644
--- a/block/blkverify.c
+++ b/block/blkverify.c
@@ -288,13 +288,12 @@ static void blkverify_refresh_filename(BlockDriverState *bs, QDict *options)
&& s->test_file->bs->full_open_options)
{
QDict *opts = qdict_new();
- qdict_put_obj(opts, "driver", QOBJECT(qstring_from_str("blkverify")));
+ qdict_put(opts, "driver", qstring_from_str("blkverify"));
QINCREF(bs->file->bs->full_open_options);
- qdict_put_obj(opts, "raw", QOBJECT(bs->file->bs->full_open_options));
+ qdict_put(opts, "raw", bs->file->bs->full_open_options);
QINCREF(s->test_file->bs->full_open_options);
- qdict_put_obj(opts, "test",
- QOBJECT(s->test_file->bs->full_open_options));
+ qdict_put(opts, "test", s->test_file->bs->full_open_options);
bs->full_open_options = opts;
}
diff --git a/block/file-posix.c b/block/file-posix.c
index 1941fb6749..fc4b052d4f 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -375,7 +375,7 @@ static void raw_parse_filename(const char *filename, QDict *options,
* function call can be ignored. */
strstart(filename, "file:", &filename);
- qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename)));
+ qdict_put(options, "filename", qstring_from_str(filename));
}
static QemuOptsList raw_runtime_opts = {
@@ -2155,7 +2155,7 @@ static void hdev_parse_filename(const char *filename, QDict *options,
/* The prefix is optional, just as for "file". */
strstart(filename, "host_device:", &filename);
- qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename)));
+ qdict_put(options, "filename", qstring_from_str(filename));
}
static bool hdev_is_sg(BlockDriverState *bs)
@@ -2454,7 +2454,7 @@ static void cdrom_parse_filename(const char *filename, QDict *options,
/* The prefix is optional, just as for "file". */
strstart(filename, "host_cdrom:", &filename);
- qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename)));
+ qdict_put(options, "filename", qstring_from_str(filename));
}
#endif
diff --git a/block/file-win32.c b/block/file-win32.c
index 7872e00a21..c4a6be7f9f 100644
--- a/block/file-win32.c
+++ b/block/file-win32.c
@@ -281,7 +281,7 @@ static void raw_parse_filename(const char *filename, QDict *options,
* function call can be ignored. */
strstart(filename, "file:", &filename);
- qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename)));
+ qdict_put(options, "filename", qstring_from_str(filename));
}
static QemuOptsList raw_runtime_opts = {
@@ -668,7 +668,7 @@ static void hdev_parse_filename(const char *filename, QDict *options,
/* The prefix is optional, just as for "file". */
strstart(filename, "host_device:", &filename);
- qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename)));
+ qdict_put(options, "filename", qstring_from_str(filename));
}
static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
diff --git a/block/quorum.c b/block/quorum.c
index 40205fb1b3..f7949e29f9 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -1096,19 +1096,15 @@ static void quorum_refresh_filename(BlockDriverState *bs, QDict *options)
children = qlist_new();
for (i = 0; i < s->num_children; i++) {
QINCREF(s->children[i]->bs->full_open_options);
- qlist_append_obj(children,
- QOBJECT(s->children[i]->bs->full_open_options));
+ qlist_append(children, s->children[i]->bs->full_open_options);
}
opts = qdict_new();
- qdict_put_obj(opts, "driver", QOBJECT(qstring_from_str("quorum")));
- qdict_put_obj(opts, QUORUM_OPT_VOTE_THRESHOLD,
- QOBJECT(qint_from_int(s->threshold)));
- qdict_put_obj(opts, QUORUM_OPT_BLKVERIFY,
- QOBJECT(qbool_from_bool(s->is_blkverify)));
- qdict_put_obj(opts, QUORUM_OPT_REWRITE,
- QOBJECT(qbool_from_bool(s->rewrite_corrupted)));
- qdict_put_obj(opts, "children", QOBJECT(children));
+ qdict_put(opts, "driver", qstring_from_str("quorum"));
+ qdict_put(opts, QUORUM_OPT_VOTE_THRESHOLD, qint_from_int(s->threshold));
+ qdict_put(opts, QUORUM_OPT_BLKVERIFY, qbool_from_bool(s->is_blkverify));
+ qdict_put(opts, QUORUM_OPT_REWRITE, qbool_from_bool(s->rewrite_corrupted));
+ qdict_put(opts, "children", children);
bs->full_open_options = opts;
}