[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 08/18] qdict qlist: Make most helper macros func
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 08/18] qdict qlist: Make most helper macros functions |
Date: |
Tue, 30 Jan 2018 11:02:24 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 01/30/2018 04:21 AM, Markus Armbruster wrote:
> The macro expansions of qdict_put_TYPE() and qlist_append_TYPE() need
> qbool.h, qnull.h, qnum.h and qstring.h to compile. We include qnull.h
> and qnum.h in the headers, but not qbool.h and qstring.h. Works,
> because we include those wherever the macros get used.
>
> Open-coding these helpers is of dubious value. Turn them into
> functions and drop the includes from the headers.
>
> This cleanup makes the number of objects depending on qapi/qmp/qnum.h
> from 4548 (out of 4739) to 46 in my "build everything" tree. For
> qapi/qmp/qnull.h, the number drops from 4549 to 21.
Impressive!
> +++ b/qobject/qdict.c
> @@ -14,6 +14,7 @@
> #include "qapi/qmp/qnum.h"
> #include "qapi/qmp/qdict.h"
> #include "qapi/qmp/qbool.h"
> +#include "qapi/qmp/qnull.h"
> #include "qapi/qmp/qstring.h"
> #include "qapi/qmp/qobject.h"
> #include "qapi/error.h"
> @@ -143,6 +144,26 @@ void qdict_put_obj(QDict *qdict, const char *key,
> QObject *value)
> }
> }
>
> +void qdict_put_int(QDict *qdict, const char *key, int64_t value)
> +{
> + qdict_put(qdict, key, qnum_from_int(value));
> +}
If I'm not mistaken (although I didn't actually test), this triggers a
false positive in scripts/coccinelle/qobject.cocci, no? Is there a
convenient way to tell coccinelle that a rewrite pattern applies
everywhere except for where the pattern itself is implemented? But even
if not, we can always use manual inspection when rerunning Coccinelle to
make sure we don't turn these into infinite loops.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH 12/18] Include qapi/qmp/qstring.h exactly where needed, (continued)
- [Qemu-devel] [PATCH 01/18] Clean up includes, Markus Armbruster, 2018/01/30
- [Qemu-devel] [PATCH 13/18] Include qapi/qmp/qbool.h exactly where needed, Markus Armbruster, 2018/01/30
- [Qemu-devel] [PATCH 17/18] Drop superfluous includes of qapi/qmp/qjson.h, Markus Armbruster, 2018/01/30
- [Qemu-devel] [PATCH 08/18] qdict qlist: Make most helper macros functions, Markus Armbruster, 2018/01/30
- Re: [Qemu-devel] [PATCH 08/18] qdict qlist: Make most helper macros functions,
Eric Blake <=
- [Qemu-devel] [PATCH 06/18] Typedef the subtypes of QObject in qemu/typedefs.h, too, Markus Armbruster, 2018/01/30
- [Qemu-devel] [PATCH 18/18] Move include qemu/option.h from qemu-common.h to actual users, Markus Armbruster, 2018/01/30
- [Qemu-devel] [PATCH 03/18] Include qapi/error.h exactly where needed, Markus Armbruster, 2018/01/30
- [Qemu-devel] [PATCH 02/18] Drop superfluous includes of qapi-types.h, Markus Armbruster, 2018/01/30