[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] qobject: Update coccinelle script to catch
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] qobject: Update coccinelle script to catch Q{INC, DEC}REF |
Date: |
Fri, 09 Jun 2017 15:28:24 +0000 |
Hi
On Fri, Jun 9, 2017 at 7:20 PM Eric Blake <address@hidden> wrote:
> A recent patch submission was about to use qobject_decref(QOBJECT(E)),
> even though we already have QDECREF(E) for that purpose. While our
> tree is currently free from the longhand form, we might as well update
>
Oh?
$ git grep 'object_unref(OBJECT(' | wc -l
152
our coccinelle script to catch any future relapses.
>
sadly, coccinelle is unabarebly slow on my machine, not easy to grasp, and
thereby fails to catch a lot of cases.. I am looking at alternative from
clang tools/lib, by curiosity.
>
> Signed-off-by: Eric Blake <address@hidden>
> ---
> scripts/coccinelle/qobject.cocci | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/scripts/coccinelle/qobject.cocci
> b/scripts/coccinelle/qobject.cocci
> index 97703a4..656dc3e 100644
> --- a/scripts/coccinelle/qobject.cocci
> +++ b/scripts/coccinelle/qobject.cocci
> @@ -3,6 +3,12 @@
> expression Obj, Key, E;
> @@
> (
> +- qobject_incref(QOBJECT(E));
> ++ QINCREF(E);
> +|
> +- qobject_decref(QOBJECT(E));
> ++ QDECREF(E);
> +|
> - qdict_put_obj(Obj, Key, QOBJECT(E));
> + qdict_put(Obj, Key, E);
> |
> --
> 2.9.4
>
>
> --
Marc-André Lureau