From 777d20cfa5735de298f378e9b90f0cd1caafdc2d Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 24 Apr 2020 10:43:31 +0200 Subject: qapi: Assert output visitors see only valid enum values output_type_enum() fails when *obj is not a valid value of the enum type. Should not happen. Drop the check, along with its unit tests. This unmasks qapi_enum_lookup()'s assertion. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Message-Id: <20200424084338.26803-9-armbru@redhat.com> [Commit message tweaked] --- qapi/qapi-visit-core.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'qapi') diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index d4aac20..80ca83b 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -341,15 +341,6 @@ static void output_type_enum(Visitor *v, const char *name, int *obj, int value = *obj; char *enum_str; - /* - * TODO why is this an error, not an assertion? If assertion: - * delete, and rely on qapi_enum_lookup() - */ - if (value < 0 || value >= lookup->size) { - error_setg(errp, QERR_INVALID_PARAMETER, name ? name : "null"); - return; - } - enum_str = (char *)qapi_enum_lookup(lookup, value); visit_type_str(v, name, &enum_str, errp); } -- cgit v1.1