diff options
author | Eric Blake <eblake@redhat.com> | 2017-04-27 16:58:14 -0500 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-05-08 20:32:14 +0200 |
commit | a2f3453ebc64b1ebe094aeaf83f9e67896f90ac3 (patch) | |
tree | 5549449efbf73347025a1e815d9bb8eb582a17e4 /scripts | |
parent | 8f16de18f6d8d0c0b4982bbe13f7b6a048b0e876 (diff) |
coccinelle: Add script to remove 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.
The script is separate from the cleanups, for ease of review and
backporting. A later patch will then add further possible cleanups.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170427215821.19397-4-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/coccinelle/qobject.cocci | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/coccinelle/qobject.cocci b/scripts/coccinelle/qobject.cocci new file mode 100644 index 0000000000..aa899e2f3b --- /dev/null +++ b/scripts/coccinelle/qobject.cocci @@ -0,0 +1,13 @@ +// Use QDict macros where they make sense +@@ +expression Obj, Key, E; +@@ +- qdict_put_obj(Obj, Key, QOBJECT(E)); ++ qdict_put(Obj, Key, E); + +// Use QList macros where they make sense +@@ +expression Obj, E; +@@ +- qlist_append_obj(Obj, QOBJECT(E)); ++ qlist_append(Obj, E); |