Commit d2788227 authored by Markus Armbruster's avatar Markus Armbruster

qapi: Fix string input visitor regression for empty lists

Visiting a list when input is the empty string should result in an
empty list, not an error.  Noticed when commit 3d089cea belatedly added
tests, but simply accepted as weird then.  It's actually a regression:
broken in commit 74f24cb6, v2.7.0.  Fix it, and throw in another test
case for empty string.
Signed-off-by: 's avatarMarkus Armbruster <>
Message-Id: <>
Reviewed-by: 's avatarMichael Roth <>
Reviewed-by: 's avatarEric Blake <>
parent c32617a1
......@@ -54,6 +54,10 @@ static int parse_str(StringInputVisitor *siv, const char *name, Error **errp)
return 0;
if (!*str) {
return 0;
do {
errno = 0;
start = strtoll(str, &endptr, 0);
......@@ -63,6 +63,11 @@ static void test_visitor_in_int(TestInputVisitorData *data,
visit_type_int(v, NULL, &res, &err);
v = visitor_input_test_init(data, "");
visit_type_int(v, NULL, &res, &err);
static void check_ilist(Visitor *v, int64_t *expected, size_t n)
......@@ -140,11 +145,11 @@ static void test_visitor_in_intList(TestInputVisitorData *data,
v = visitor_input_test_init(data, "18446744073709551615");
check_ulist(v, expect4, ARRAY_SIZE(expect4));
/* Empty list is invalid (weird) */
/* Empty list */
v = visitor_input_test_init(data, "");
visit_type_int64List(v, NULL, &res, &err);
visit_type_int64List(v, NULL, &res, &error_abort);
/* Not a list */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment