aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-08-24 10:45:57 +0200
committerMarkus Armbruster <armbru@redhat.com>2017-09-04 13:09:13 +0200
commit06c60b6c468ca7cde004fe7c3ce35de312855f55 (patch)
tree33e164badc15e320421ba47f5a26a622f4d85dee /tests
parent64355088e0213b564eb6ef5d2658210accfcc32f (diff)
qapi: Drop superfluous qapi_enum_parse() parameter max
The lookup tables have a sentinel, no need to make callers pass their size. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1503564371-26090-3-git-send-email-armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [Rebased, commit message corrected]
Diffstat (limited to 'tests')
-rw-r--r--tests/qmp-test.c3
-rw-r--r--tests/test-qapi-util.c15
2 files changed, 6 insertions, 12 deletions
diff --git a/tests/qmp-test.c b/tests/qmp-test.c
index 5ce886312a..b5f21dfa57 100644
--- a/tests/qmp-test.c
+++ b/tests/qmp-test.c
@@ -182,8 +182,7 @@ static void test_query(const void *data)
} else {
g_assert(error);
g_assert_cmpint(qapi_enum_parse(QapiErrorClass_lookup, error_class,
- QAPI_ERROR_CLASS__MAX, -1,
- &error_abort),
+ -1, &error_abort),
==, expected_error_class);
}
QDECREF(resp);
diff --git a/tests/test-qapi-util.c b/tests/test-qapi-util.c
index e8697577a5..d72ee8c4e7 100644
--- a/tests/test-qapi-util.c
+++ b/tests/test-qapi-util.c
@@ -20,25 +20,20 @@ static void test_qapi_enum_parse(void)
Error *err = NULL;
int ret;
- ret = qapi_enum_parse(QType_lookup, NULL, QTYPE__MAX, QTYPE_NONE,
- &error_abort);
+ ret = qapi_enum_parse(QType_lookup, NULL, QTYPE_NONE, &error_abort);
g_assert_cmpint(ret, ==, QTYPE_NONE);
- ret = qapi_enum_parse(QType_lookup, "junk", QTYPE__MAX, -1,
- NULL);
+ ret = qapi_enum_parse(QType_lookup, "junk", -1, NULL);
g_assert_cmpint(ret, ==, -1);
- ret = qapi_enum_parse(QType_lookup, "junk", QTYPE__MAX, -1,
- &err);
+ ret = qapi_enum_parse(QType_lookup, "junk", -1, &err);
error_free_or_abort(&err);
- ret = qapi_enum_parse(QType_lookup, "none", QTYPE__MAX, -1,
- &error_abort);
+ ret = qapi_enum_parse(QType_lookup, "none", -1, &error_abort);
g_assert_cmpint(ret, ==, QTYPE_NONE);
ret = qapi_enum_parse(QType_lookup, QType_lookup[QTYPE__MAX - 1],
- QTYPE__MAX, QTYPE__MAX - 1,
- &error_abort);
+ QTYPE__MAX - 1, &error_abort);
g_assert_cmpint(ret, ==, QTYPE__MAX - 1);
}