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 3d089ce belatedly added
tests, but simply accepted as weird then. It's actually a regression:
broken in commit 74f24cb, v2.7.0. Fix it, and throw in another test
case for empty string.

Backports commit d2788227c6185c72d88ef3127e9fed41686f8e39 from qemu
This commit is contained in:
Markus Armbruster 2018-03-03 17:30:39 -05:00 committed by Lioncash
parent 247a511c4a
commit 09efe97bfd
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -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);