Eric Blake <ebl...@redhat.com> 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 <arm...@redhat.com> >> --- >> 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 <ebl...@redhat.com> Thanks! [...]