qapi: Avoid unnecessary use of enum lookup table's sentinel

Currently, the FOO_lookup[] generated for QAPI enum types are
terminated by a NULL sentinel.

A future patch will generate enums with "holes".  NULL-termination
will cease to work then.

To prepare for that, replace "have we reached the sentinel?"
predicates by "have we reached the FOO__MAX value?" predicates.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503564371-26090-12-git-send-email-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Markus Armbruster 2017-08-24 10:46:06 +02:00
parent 113e47ae6d
commit 1c236ba531
4 changed files with 5 additions and 5 deletions

View file

@ -279,7 +279,7 @@ static void test_visitor_in_enum(TestInputVisitorData *data,
Visitor *v;
EnumOne i;
for (i = 0; EnumOne_lookup[i]; i++) {
for (i = 0; i < ENUM_ONE__MAX; i++) {
EnumOne res = -1;
v = visitor_input_test_init(data, EnumOne_lookup[i]);