diff options
author | Markus Armbruster <armbru@redhat.com> | 2017-08-24 10:46:06 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-09-04 13:09:13 +0200 |
commit | 1c236ba5319d6141964fddb38f1d942cebcaed05 (patch) | |
tree | 382b6dcf8bceacb9df4c3f23c34b05b2bf3b1c05 /tests | |
parent | 113e47ae6dc45b08e732dd5fa85abe71b764f5ae (diff) | |
download | qemu-1c236ba5319d6141964fddb38f1d942cebcaed05.zip qemu-1c236ba5319d6141964fddb38f1d942cebcaed05.tar.gz qemu-1c236ba5319d6141964fddb38f1d942cebcaed05.tar.bz2 |
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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-qobject-input-visitor.c | 2 | ||||
-rw-r--r-- | tests/test-string-input-visitor.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/test-qobject-input-visitor.c b/tests/test-qobject-input-visitor.c index bcf0261..5bbfb65 100644 --- a/tests/test-qobject-input-visitor.c +++ b/tests/test-qobject-input-visitor.c @@ -382,7 +382,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, "%s", EnumOne_lookup[i]); diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c index 79313a7..e7a7b80 100644 --- a/tests/test-string-input-visitor.c +++ b/tests/test-string-input-visitor.c @@ -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]); |