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>
}
len = strlen(str);
readline_set_completion_index(rs, len);
- for (i = 0; NetClientDriver_lookup[i]; i++) {
+ for (i = 0; i < NET_CLIENT_DRIVER__MAX; i++) {
add_completion_option(rs, str, NetClientDriver_lookup[i]);
}
}
return;
}
readline_set_completion_index(rs, strlen(str));
- for (i = 0; WatchdogExpirationAction_lookup[i]; i++) {
+ for (i = 0; i < WATCHDOG_EXPIRATION_ACTION__MAX; i++) {
add_completion_option(rs, str, WatchdogExpirationAction_lookup[i]);
}
}
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]);
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]);
{
int i;
- for (i = 0; QKeyCode_lookup[i] != NULL; i++) {
+ for (i = 0; i < Q_KEY_CODE__MAX; i++) {
if (!strncmp(key, QKeyCode_lookup[i], key_length) &&
!QKeyCode_lookup[i][key_length]) {
break;