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. > 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", 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> > > diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py > index aec2d32..aed45d6 100644 > --- a/scripts/qapi-event.py > +++ b/scripts/qapi-event.py > @@ -153,63 +153,6 @@ def generate_event_implement(api_name, event_name, > params): > - # append automatically generated _MAX value > - enum_max_value = c_enum_const(event_enum_name, "MAX") > - enum_values = event_enum_values + [ enum_max_value ] [1] -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature