[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC v2 30/47] qapi: De-duplicate enum code gener
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH RFC v2 30/47] qapi: De-duplicate enum code generation |
Date: |
Tue, 28 Jul 2015 10:13:15 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Eric Blake <address@hidden> writes:
> On 07/01/2015 02:22 PM, Markus Armbruster wrote:
>> Duplicated in commit 21cd70d. Yes, we can't import qapi-types, but
>> that's no excuse. Move the helpers from qapi-types.py to qapi.py, and
>> replace the duplicates in qapi-event.py.
>>
>> The generated event enumeration type gains a _MAX member,
>
> Not quite; the _MAX member was already there, but done by hand [1]
> instead of by common code.
You're right; I was confused.
>> and its
>> lookup table becomes const-correct (see commit 2e4450f).
>
> Maybe what you meant instead of gaining _MAX was that it also gains C99
> initializers:
>
> -const char *QAPIEvent_lookup[] = {
> - "ACPI_DEVICE_OST",
> - "BALLOON_CHANGE",
> ...
> - "WATCHDOG",
> - NULL,
> +const char *const QAPIEvent_lookup[] = {
> + [QAPI_EVENT_ACPI_DEVICE_OST] = "ACPI_DEVICE_OST",
> + [QAPI_EVENT_BALLOON_CHANGE] = "BALLOON_CHANGE",
That's not what I had in mind when I wrote the sentence about _MAX. but
mentioning the change in the commit message won't hurt. Note to self:
comes from commit 912ae9c.
> Overall, a good change.
>
>>
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>> scripts/qapi-event.py | 67
>> +++------------------------------------------------
>> scripts/qapi-types.py | 55 ------------------------------------------
>> scripts/qapi.py | 55 ++++++++++++++++++++++++++++++++++++++++++
>> 3 files changed, 59 insertions(+), 118 deletions(-)
>
> Since only the commit message needs tweaking,
> Reviewed-by: Eric Blake <address@hidden>
Thanks!
[...]