On 04/19/2018 08:20 AM, Gerd Hoffmann wrote: > Add parse_display_qapi() function which parses the -display command line > using a qapi visitor for DisplayOptions. Wire up as default catch in > parse_display(). > > Improves the error message for unknown display types. > > Also enables json as -display argument, i.e. -display "{ 'type': 'gtk' }" > > Signed-off-by: Gerd Hoffmann > --- > + > + /* > + * We don't have any dynamically allocated stuff inside > + * DisplayOptions, so we can simply copy the struct content and > + * free opts without ending up with pointers pointing into > + * nowhere. > + */ > + dpy = *opts; > + qapi_free_DisplayOptions(opts); That's risky; would it be better to use QAPI_CLONE_MEMBERS() to not have to worry about if we add a pointer in the future? -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org