[libvirt] [PATCH 2/2] qemu: event: Clean up VNC monitor handling
Jiri Denemark
jdenemar at redhat.com
Tue Jun 30 09:08:34 UTC 2015
On Mon, Jun 29, 2015 at 17:13:59 +0200, Peter Krempa wrote:
> Get rid of spice specific stuff from the handler func and save a few
> lines by reflowing the conditions.
> ---
> src/qemu/qemu_monitor_json.c | 29 +++++++++++++----------------
> 1 file changed, 13 insertions(+), 16 deletions(-)
>
> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index ba1e4f9..e9af1e1 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -638,40 +638,37 @@ qemuMonitorJSONHandleGraphicsVNC(qemuMonitorPtr mon,
> return;
> }
>
> - authScheme = virJSONValueObjectGetString(server, "auth");
> - if (!authScheme) {
> + if (!(authScheme = virJSONValueObjectGetString(server, "auth"))) {
> /* not all events are required to contain auth scheme */
> VIR_DEBUG("missing auth scheme in graphics event");
> authScheme = "";
> }
>
> - localFamily = virJSONValueObjectGetString(server, "family");
> - if (!localFamily) {
> + if (!(localFamily = virJSONValueObjectGetString(server, "family"))) {
> VIR_WARN("missing local address family in graphics event");
> return;
> }
> - localNode = virJSONValueObjectGetString(server, "host");
> - if (!localNode) {
> + if (!(localNode = virJSONValueObjectGetString(server, "host"))) {
> VIR_WARN("missing local hostname in graphics event");
> return;
> }
> - localService = virJSONValueObjectGetString(server, "service");
> - if (!localService)
> - localService = ""; /* Spice has multiple ports, so this isn't provided */
> + if (!(localService = virJSONValueObjectGetString(server, "service"))) {
> + VIR_WARN("missing local service in graphics event");
> + return;
> + }
>
> - remoteFamily = virJSONValueObjectGetString(client, "family");
> - if (!remoteFamily) {
> + if (!(remoteFamily = virJSONValueObjectGetString(client, "family"))) {
> VIR_WARN("missing remote address family in graphics event");
> return;
> }
> - remoteNode = virJSONValueObjectGetString(client, "host");
> - if (!remoteNode) {
> + if (!(remoteNode = virJSONValueObjectGetString(client, "host"))) {
> VIR_WARN("missing remote hostname in graphics event");
> return;
> }
> - remoteService = virJSONValueObjectGetString(client, "service");
> - if (!remoteService)
> - remoteService = ""; /* Spice has multiple ports, so this isn't provided */
> + if (!(remoteService = virJSONValueObjectGetString(client, "service"))) {
> + VIR_WARN("missing remote service in graphics event");
> + return;
> + }
>
> saslUsername = virJSONValueObjectGetString(client, "sasl_username");
> x509dname = virJSONValueObjectGetString(client, "x509_dname");
It might be worth doing s/graphics event/VNC event/
ACK
Jirka
More information about the libvir-list
mailing list