On Tue, Jan 16, 2024 at 05:12:35PM +0100, Peter Krempa wrote:
> diff --git a/tests/qemucapabilitiesnumbering.c
> b/tests/qemucapabilitiesnumbering.c
> index 6f33321e17..2aabdf72c7 100644
> --- a/tests/qemucapabilitiesnumbering.c
> +++ b/tests/qemucapabilitiesnumbering.c
> @@ -137,10 +137,32 @@ printLineSkipEmpty(const char *p,
> virBuffer *buf)
> {
> for (; *p; p++) {
> - if (p[0] == '\n' && p[1] == '\n')
> - continue;
> -
> virBufferAddChar(buf, *p);
> +
> + /* YAJL formats empty objects and arrays in a weird way:
> + *
> + * {
> + * "emptyarray": [
> + *
> + * ],
> + * "emptyobject": {
> + *
> + * }
> + * }
> + *
> + * We want to use empty lines to separate commands and replies as
> + * well as be compatible with python's 'json.dump' method, thus we
> drop
> + * any whitespace between array/object braces.
> + */
> + if ((p[0] == '{' || p[0] == '[') && p[1] == '\n') {
I think you can lose the check on p[1]: whenever there's an opening
token, we can just skip all whitespace, including the initial
newline.
Either way,
Reviewed-by: Andrea Bolognani <[email protected]>
--
Andrea Bolognani / Red Hat / Virtualization
_______________________________________________
Devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]