From nobody Mon Feb 9 08:29:57 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588831120; cv=none; d=zohomail.com; s=zohoarc; b=DhXElj930I2leIYXJ99AJFNMcwARc6P456vqZJpZDfsJDNJCX7J2ZJTGiTPA06WWiTf1rWxglYV+jnRVJFYH6fA1PlE3m1rt9KtlMQsSnQkK/9whTYCtHo3liC7DIkkvPFuzCTK1hiJIIci6y9tc9Qx+CMBQ2H9r4yctHgez+to= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588831120; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lPo7wYfg1muhD4cRRYcEMFDmgF6saURg6q9K0wUPjHU=; b=i+ppAEwjvcCKgzOnxNNKGXZ6XtpYuerNMB76uCDZTKsILEvSBYtVaIH6+VelabNBorehsjeS3ae+en7Teqk7XRjcn8ez2CWCya9bU0A4W7zCZyG2rn+D+RhnexfKMvvkBgeb6h84Sf3JNqXd37G6oCAUQiZG9hmU7JVFh5TO2YQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1588831120639947.2622076362484; Wed, 6 May 2020 22:58:40 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-424-_zFViZpbP9uA1PDJ_IMDZA-1; Thu, 07 May 2020 01:58:37 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B4A04100CCC0; Thu, 7 May 2020 05:58:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8F0DF5C28E; Thu, 7 May 2020 05:58:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4C47C1809557; Thu, 7 May 2020 05:58:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0475wCxD015398 for ; Thu, 7 May 2020 01:58:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 116165D9DA; Thu, 7 May 2020 05:58:12 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7820D5D9C5 for ; Thu, 7 May 2020 05:58:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588831119; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=lPo7wYfg1muhD4cRRYcEMFDmgF6saURg6q9K0wUPjHU=; b=KInOgadeAQbYjm0BkQNKjNHXlzhNkLEGaAJyNU9YcmktYpdBurWtCiJ7dflgGjZivlkDf8 JfRsLQadTDUcKT1UoDa/McRqTCi91svi05YFlSQEEwQknwqKNvgnBhHRgbBdenoEokxwnQ hEgmRKxjIJASxqSargC0ALt7HCt1RZM= X-MC-Unique: _zFViZpbP9uA1PDJ_IMDZA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/8] qemuMonitorJSONGetDeviceProps: Refactor to modern standards Date: Thu, 7 May 2020 07:57:59 +0200 Message-Id: <452311bb8264fe912a37d35aeb887fdba746bfe3.1588830947.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use automatic cleanup of variables and current style of header. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor_json.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 619717eae5..9d1db07ccd 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6745,13 +6745,13 @@ qemuMonitorJSONParsePropsList(virJSONValuePtr cmd, } -int qemuMonitorJSONGetDeviceProps(qemuMonitorPtr mon, - const char *device, - char ***props) +int +qemuMonitorJSONGetDeviceProps(qemuMonitorPtr mon, + const char *device, + char ***props) { - int ret =3D -1; - virJSONValuePtr cmd; - virJSONValuePtr reply =3D NULL; + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; *props =3D NULL; @@ -6761,18 +6761,12 @@ int qemuMonitorJSONGetDeviceProps(qemuMonitorPtr mo= n, return -1; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) - goto cleanup; + return -1; - if (qemuMonitorJSONHasError(reply, "DeviceNotFound")) { - ret =3D 0; - goto cleanup; - } + if (qemuMonitorJSONHasError(reply, "DeviceNotFound")) + return 0; - ret =3D qemuMonitorJSONParsePropsList(cmd, reply, NULL, props); - cleanup: - virJSONValueFree(reply); - virJSONValueFree(cmd); - return ret; + return qemuMonitorJSONParsePropsList(cmd, reply, NULL, props); } --=20 2.26.2