On 3/22/20 4:11 AM, Eyal Moscovici wrote:
Previously dump_map_entry identified whether we need to start a new JSON
array based on whether start address == 0. In this refactor we remove
this assumption as in following patches we will allow map to start from
an arbitrary position.

Acked-by: Mark Kanda <mark.ka...@oracle.com>
Signed-off-by: Eyal Moscovici <eyal.moscov...@oracle.com>
---
  qemu-img.c | 12 ++++++++----
  1 file changed, 8 insertions(+), 4 deletions(-)


@@ -2871,8 +2870,8 @@ static int dump_map_entry(OutputFormat output_format, 
MapEntry *e,
          }
          putchar('}');
- if (!next) {
-            printf("]\n");
+        if (next) {
+            printf(",\n");

As long as you're touching this, puts(",") is slightly more efficient than printf(). But what you have is not wrong.

Reviewed-by: Eric Blake <ebl...@redhat.com>

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


Reply via email to