From nobody Wed May 1 23:43:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1628617538; cv=none; d=zohomail.com; s=zohoarc; b=Zoi1iUHGaqnSHqe+gQM05xDVAmuOToQWL+zCNaMKS9wjWCspYQKsKM+vX7SR6vcmvC9HK3ijMQiqUpyW+c2VDn2vGDh8a0UvT4l81nWNBxGoI8u94k6c5UUXNswWfkthqwKr2TmqkogPnhlg3hI7LpLhrkjSJBmIWagF75JpbH4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628617538; 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=Xe2ahXsh/iJayNTW0TYZIWjD/YP1Re/hl65ZP+8F21Q=; b=hW1/bqiGrc2uo4oADtLLMHfovDIrFdWkXdTQLKj0/6WvpWZhHjQg2BEmbFvcCtw1H6Q2mSn66wsbR9KJYWC2T0nRhCFSV1D7D0w3wqZDlETagrImFJOgwHWKLMSB0y+h6JwgBfavjcfVWawecoxkAwO9BcZ5iWHdLgWTHHLggbU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1628617538404659.9866378232401; Tue, 10 Aug 2021 10:45:38 -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-91-n7TI5IPDNtCwPP_kSyVGIw-1; Tue, 10 Aug 2021 13:45:34 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 61FC18799EE; Tue, 10 Aug 2021 17:45:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4418A6E0B8; Tue, 10 Aug 2021 17:45:28 +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 143604A700; Tue, 10 Aug 2021 17:45:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17AHjJk6025700 for ; Tue, 10 Aug 2021 13:45:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 97215136F5; Tue, 10 Aug 2021 17:45:19 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 20EFD5B4BC for ; Tue, 10 Aug 2021 17:45:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628617537; 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=Xe2ahXsh/iJayNTW0TYZIWjD/YP1Re/hl65ZP+8F21Q=; b=Gmv+fl3/26RW2S39Fy1G84/4/qmVqUmOlfg+tk2DDZ9RrXqG71WgSRYlBp2RGr/dmDpu/Z iDxPxRzRbB3wbKDEKXIrhpd+5Uv8tNcxj/nQJeDiKIH39Qa6875HYF39421wage+uOJS9n p3TG6H/BJJG9JJvZRvAulwugeOp5V6M= X-MC-Unique: n7TI5IPDNtCwPP_kSyVGIw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 01/10] vsh: table: define cleanup function Date: Tue, 10 Aug 2021 19:45:00 +0200 Message-Id: <3fa81ee05b8089b2e64dd8b7bcea15e3d6ace5a5.1628617414.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628617540166100003 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- tools/vsh-table.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/vsh-table.h b/tools/vsh-table.h index a8cfca62d5..5ce416cfa1 100644 --- a/tools/vsh-table.h +++ b/tools/vsh-table.h @@ -30,3 +30,4 @@ vshTable *vshTableNew(const char *format, ...); int vshTableRowAppend(vshTable *table, const char *arg, ...); void vshTablePrintToStdout(vshTable *table, vshControl *ctl); char *vshTablePrintToString(vshTable *table, bool header); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(vshTable, vshTableFree); --=20 2.31.1 From nobody Wed May 1 23:43:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1628617543; cv=none; d=zohomail.com; s=zohoarc; b=jKm2jLj0wzOh6TV8p6VkzXwWDkddjHGNUvGWlNY2hjEBRHSFYZ5xXx+Ap4uojir0VaSUyRgcyS9e50x0ZttxjmqwfSVTVy3u116GIx90vaJzbWrvuTUCnGGHYSYAzMl+Xk9iMLN80cGtigd/e/rTXcj3aAd1/Rz08unrmXrPSqc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628617543; 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=bPCtPhROlB9ON320MKoIzCdL4xnQeuKoIQFg823xkxU=; b=I2lf5DERTb00wvA+LqH0umgjAvmhFmTICeWDWZZ7rNUw5Z2ov581rWmzQKJWdNkgi0T0k1P1G4OybMkJJEPNzbFQqJM9UwR4J0dYI1FqAetrbFjWQS48HyM43cWWFFIjYzgIIy76If8C7LamKpFYTyqkwykpRds5P40HtfrbR3U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1628617543941971.0251426112117; Tue, 10 Aug 2021 10:45:43 -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-443-abxGb0HZN7GKTBCP-cun0Q-1; Tue, 10 Aug 2021 13:45:40 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5C6D1100A606; Tue, 10 Aug 2021 17:45: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 4015D6E0B8; Tue, 10 Aug 2021 17:45: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 0F6C2181A2A6; Tue, 10 Aug 2021 17:45:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17AHjKY0025711 for ; Tue, 10 Aug 2021 13:45:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6637F18A9E; Tue, 10 Aug 2021 17:45:20 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3A71136F5 for ; Tue, 10 Aug 2021 17:45:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628617542; 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=bPCtPhROlB9ON320MKoIzCdL4xnQeuKoIQFg823xkxU=; b=NCy9iVZQmVqjm4pfcrW0u4t8kUP0tpvMyoVcF+4/TZNXz1WvCn3to2PvVYwrG9eXUzL+hn Gxmjco0c4BLOwHsfVRbhKsD7PB7s3yQwBRrjURds/o93CU+DtXw67cdoMQ3vXDqYCaI1Bh 0yZwORv/SyJps+tDqAL+d9dnuUDdnx4= X-MC-Unique: abxGb0HZN7GKTBCP-cun0Q-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 02/10] virsh: add cleanup function for virshDomainCheckpoint Date: Tue, 10 Aug 2021 19:45:01 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628617544632100002 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- tools/virsh-util.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/virsh-util.h b/tools/virsh-util.h index 87673bce9f..ba79d04fb8 100644 --- a/tools/virsh-util.h +++ b/tools/virsh-util.h @@ -50,8 +50,10 @@ void virshSecretFree(virSecretPtr secret); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virshSecret, virshSecretFree); =20 +typedef virDomainCheckpoint virshDomainCheckpoint; void virshDomainCheckpointFree(virDomainCheckpointPtr chk); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virshDomainCheckpoint, virshDomainCheckpoint= Free); =20 void virshDomainSnapshotFree(virDomainSnapshotPtr snap); --=20 2.31.1 From nobody Wed May 1 23:43:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1628617530; cv=none; d=zohomail.com; s=zohoarc; b=a1+Po013tizgv5DGB5u1h8s41OInAlcISV92AsF5d6ORD2mnsWtnB3DDJ2sT6Z10lrKmGR45rqQYMwxWNmQPk7Qad9eohWTCyr2kc+G7XqkWuUUryXMf74HyyGFz6zkfQBfF+9POY1JjfkLB0NuXtE6EH6s3kfrxfpH5CY5FO+s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628617530; 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=GI7MQfS/MtQt4WSlX1/l+o5idXTPmWNOxfPyDJUZSQo=; b=geYr1J+Y6ABowHhtBO47OAgwkV+sQXVldR9cnhcy43Yopx94hgCLGvYpZzWVERik/RohhzparTpIqmwnm8G8CIPLVK95iJ2znPJ5EzsKTk4z3dbTXXbXkhJCrDb34OE9djAywL32AX05jYSKQRiw+E47y4EcMGgWkQ8wlKxiDaU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1628617530876989.2439831698207; Tue, 10 Aug 2021 10:45:30 -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-304-AIDq_WVMMLmo6jvLduu13w-1; Tue, 10 Aug 2021 13:45:27 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E08358799EC; Tue, 10 Aug 2021 17:45:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B36D427CA4; Tue, 10 Aug 2021 17:45:22 +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 D3B614A7C8; Tue, 10 Aug 2021 17:45:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17AHjLfq025721 for ; Tue, 10 Aug 2021 13:45:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 346C5136F5; Tue, 10 Aug 2021 17:45:21 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id B28A1620DE for ; Tue, 10 Aug 2021 17:45:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628617529; 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=GI7MQfS/MtQt4WSlX1/l+o5idXTPmWNOxfPyDJUZSQo=; b=c8E43D4dgB9i/7BmaLzihLNWvjbI73Q26lBdOtRqx7PNmIWuG+Bk9YKI34Zf8kMKN9fz3y x0Kcetqfw/NuFtfUdIFAynUJfj1wenMwwaNox0kHpVxhHxh18z2dV9DcGSUkKMeFr258sE dPEbY3/gUxq3TO7BsjcYGMqWb7H7TOo= X-MC-Unique: AIDq_WVMMLmo6jvLduu13w-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 03/10] virsh: add cleanup function for virshDomainSnapshot Date: Tue, 10 Aug 2021 19:45:02 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628617531867100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- tools/virsh-util.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/virsh-util.h b/tools/virsh-util.h index ba79d04fb8..6115b05d4d 100644 --- a/tools/virsh-util.h +++ b/tools/virsh-util.h @@ -55,8 +55,10 @@ void virshDomainCheckpointFree(virDomainCheckpointPtr chk); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virshDomainCheckpoint, virshDomainCheckpoint= Free); =20 +typedef virDomainSnapshot virshDomainSnapshot; void virshDomainSnapshotFree(virDomainSnapshotPtr snap); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virshDomainSnapshot, virshDomainSnapshotFree= ); =20 int virshDomainState(vshControl *ctl, --=20 2.31.1 From nobody Wed May 1 23:43:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1628617641; cv=none; d=zohomail.com; s=zohoarc; b=S+wsE34zFaKxbwDGBPDOtfQrBficA6ZpbRuIHBg232kX+k4fZLhYHa41UfCskVlqs5Rh2b+uv35bEGF8wbNfqWXZudAFjcFhjtPX08LGxOppjTXb1GuLAJtCbKt7LmZAaNo4eTzinmB1uSA6ks7Kf0j+nATSUJ+NOUPltfajetU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628617641; 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=YwaAfATn5OrcFRM33lG8xRcifJ8mUXtXQ7PDNjFJILY=; b=iUfiMTeubujGNXcguEhMmWyyXX7zBSPWbaYXdB7uVoakKq/HmB0YxAlI8jYTXlQ+Pj1d5awAM+xpvI1XtEEYKqzsXkFWdck4mLFgIXDuo3Ad6uNp2lZa1+JpTwkhM+FFez1Bldh8dWONqejqWKRWFHoQIPRH1A7vZxVsrQle55c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1628617641820492.97493711782556; Tue, 10 Aug 2021 10:47:21 -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-133-7wAYPF-TN3S456UJPaZLqQ-1; Tue, 10 Aug 2021 13:46:11 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EF44B100A606; Tue, 10 Aug 2021 17:46:04 +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 5100C10429FE; Tue, 10 Aug 2021 17:46:04 +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 A8133181A2A5; Tue, 10 Aug 2021 17:46:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17AHjMfl025726 for ; Tue, 10 Aug 2021 13:45:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 03A70136F5; Tue, 10 Aug 2021 17:45:22 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8152C5B4BC for ; Tue, 10 Aug 2021 17:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628617640; 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=YwaAfATn5OrcFRM33lG8xRcifJ8mUXtXQ7PDNjFJILY=; b=Y42nHVGeTg6sbFgoKA2XEJi+f/8/UTxDUGtPdI0wOm4NQNODAnofk6vCuNnz6Jv/Lg3hm0 1Q5TUrvp1IORZs8oDAVuzLkt6YoXY+gRcIkDxKlL1FEFgb7pWFpO0YMKUnQP+xGWZR56kQ mCBx6HWAgK7OBGJ6SbE6umiCyWQY2r4= X-MC-Unique: 7wAYPF-TN3S456UJPaZLqQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 04/10] virsh: checkpoint: move variables inside the loop Date: Tue, 10 Aug 2021 19:45:03 +0200 Message-Id: <5ca7d69f19347736796c280725e45ab434e9c9fb.1628617414.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628617643301100001 Use g_auto to free them instead of open-coding it. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- tools/virsh-checkpoint.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index e88f9ffb47..2b89f376c9 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -716,9 +716,6 @@ cmdCheckpointList(vshControl *ctl, bool ret =3D false; unsigned int flags =3D 0; size_t i; - xmlDocPtr xml =3D NULL; - xmlXPathContextPtr ctxt =3D NULL; - char *doc =3D NULL; virDomainCheckpointPtr checkpoint =3D NULL; long long creation_longlong; g_autoptr(GDateTime) then =3D NULL; @@ -728,7 +725,6 @@ cmdCheckpointList(vshControl *ctl, bool parent =3D vshCommandOptBool(cmd, "parent"); bool roots =3D vshCommandOptBool(cmd, "roots"); const char *from_chk =3D NULL; - char *parent_chk =3D NULL; virDomainCheckpointPtr start =3D NULL; struct virshCheckpointList *checkpointlist =3D NULL; vshTable *table =3D NULL; @@ -805,14 +801,12 @@ cmdCheckpointList(vshControl *ctl, =20 for (i =3D 0; i < checkpointlist->nchks; i++) { g_autofree gchar *thenstr =3D NULL; + g_autoptr(xmlDoc) xml =3D NULL; + g_autoptr(xmlXPathContext) ctxt =3D NULL; + g_autofree char *parent_chk =3D NULL; + g_autofree char *doc =3D NULL; const char *chk_name; =20 - /* free up memory from previous iterations of the loop */ - VIR_FREE(parent_chk); - xmlXPathFreeContext(ctxt); - xmlFreeDoc(xml); - VIR_FREE(doc); - checkpoint =3D checkpointlist->chks[i].chk; chk_name =3D virDomainCheckpointGetName(checkpoint); assert(chk_name); @@ -856,13 +850,8 @@ cmdCheckpointList(vshControl *ctl, ret =3D true; =20 cleanup: - /* this frees up memory from the last iteration of the loop */ virshCheckpointListFree(checkpointlist); - VIR_FREE(parent_chk); virshDomainCheckpointFree(start); - xmlXPathFreeContext(ctxt); - xmlFreeDoc(xml); - VIR_FREE(doc); virshDomainFree(dom); vshTableFree(table); =20 --=20 2.31.1 From nobody Wed May 1 23:43:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1628617758; cv=none; d=zohomail.com; s=zohoarc; b=kOBxNYuFQ5d9C0B+UR3syOzve6KzjaxOyc8HWxiaqUIMRfn2AzdSQjan8CS01C2A0ClNA2obU9hFmcnrUoKgBzpu3Q/UeqFSxKx2c55ErjmmU3V0uz6YI0llpTbJKojwQk0IOSh4TvXH1gvEK4s5KrHwUNfz6/w6idNALi8RaBo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628617758; 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=j6VpceO4CTbvcVem9XyrfZphBp9fmY5b4RjdLGLuRGo=; b=DRick/MJDfmKYGb1U9Z0zjLS7bP4mpNL8pm8wMvoms86Joqyg/OGSncGfhnScNJLtmiNDrcPeVaE2x75LsbJ5lmsgfSy4YYXeb325SYuWv/zyan5cf3cCDFHLrPoTxgGX9FRLPmWR5HhMjDUuFyAEde+b21LJpf7MMPkbLVKrHk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1628617758951937.6590085531716; Tue, 10 Aug 2021 10:49:18 -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-322-Sh-59WAgOqufZ31iwglQJA-1; Tue, 10 Aug 2021 13:45:34 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 80BD3100A60D; Tue, 10 Aug 2021 17:45:28 +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 596CE100763B; Tue, 10 Aug 2021 17:45:28 +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 25ADE181A1D3; Tue, 10 Aug 2021 17:45:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17AHjMKL025740 for ; Tue, 10 Aug 2021 13:45:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id C6ADA6E0B7; Tue, 10 Aug 2021 17:45:22 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 502D5620DE for ; Tue, 10 Aug 2021 17:45:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628617758; 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=j6VpceO4CTbvcVem9XyrfZphBp9fmY5b4RjdLGLuRGo=; b=IPq05JdS1W7kC/MKGy/NbSL0K4auHDcFu+3rvR4hSUO7jm5kA3JNGFbEKimLyrqaBNakIS IyhJLbv/m/au3ImOtajIbB8SlrGT/h01OnFPVuwOSB3qNgW/BQkVQgwfLfjSx+cR6ufyA/ krJohQxucLj8wTGU7ztcXBdcR02KB0o= X-MC-Unique: Sh-59WAgOqufZ31iwglQJA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 05/10] virsh: snapshot: move variables inside the loop Date: Tue, 10 Aug 2021 19:45:04 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628617759407100001 Use g_auto to free them, instead of open-coding it. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- tools/virsh-snapshot.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index e64117785c..350f9e803c 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -1490,11 +1490,7 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) bool ret =3D false; unsigned int flags =3D 0; size_t i; - xmlDocPtr xml =3D NULL; - xmlXPathContextPtr ctxt =3D NULL; - char *doc =3D NULL; virDomainSnapshotPtr snapshot =3D NULL; - char *state =3D NULL; long long creation_longlong; g_autoptr(GDateTime) then =3D NULL; bool tree =3D vshCommandOptBool(cmd, "tree"); @@ -1504,7 +1500,6 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) bool roots =3D vshCommandOptBool(cmd, "roots"); bool current =3D vshCommandOptBool(cmd, "current"); const char *from_snap =3D NULL; - char *parent_snap =3D NULL; virDomainSnapshotPtr start =3D NULL; struct virshSnapshotList *snaplist =3D NULL; vshTable *table =3D NULL; @@ -1592,15 +1587,13 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) =20 for (i =3D 0; i < snaplist->nsnaps; i++) { g_autofree gchar *thenstr =3D NULL; + g_autoptr(xmlDoc) xml =3D NULL; + g_autoptr(xmlXPathContext) ctxt =3D NULL; + g_autofree char *parent_snap =3D NULL; + g_autofree char *state =3D NULL; + g_autofree char *doc =3D NULL; const char *snap_name; =20 - /* free up memory from previous iterations of the loop */ - VIR_FREE(parent_snap); - VIR_FREE(state); - xmlXPathFreeContext(ctxt); - xmlFreeDoc(xml); - VIR_FREE(doc); - snapshot =3D snaplist->snaps[i].snap; snap_name =3D virDomainSnapshotGetName(snapshot); assert(snap_name); @@ -1648,14 +1641,8 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) ret =3D true; =20 cleanup: - /* this frees up memory from the last iteration of the loop */ virshSnapshotListFree(snaplist); - VIR_FREE(parent_snap); - VIR_FREE(state); virshDomainSnapshotFree(start); - xmlXPathFreeContext(ctxt); - xmlFreeDoc(xml); - VIR_FREE(doc); virshDomainFree(dom); vshTableFree(table); =20 --=20 2.31.1 From nobody Wed May 1 23:43:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1628617543; cv=none; d=zohomail.com; s=zohoarc; b=FD+ayfx/EcORITN4/cZnH6jaEtGg+wtO1hgUkkFg6jWDurQcwxky9QhJ4Hx3CEt3nXAEMiE+f7vAn9ZqdRBs7u6WF3X+wAp6fqPnxVLwfgBzPnnU+kPTT+bWuEOTwnp/EBP2nnsEm8r8E2rAmo06fxi+NNLfhuq3WgGKK2Mgsh8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628617543; 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=Yyq0bz7x3mH5hwXguzXFZxUcXvEVx94DXvYswdYZ/kg=; b=PgL+QjlGqLDHyfy3HLP+DYwQjE1h3fBBsNT/FlWhKvdXN1y69SQ/yT1KD9nS3RS51sjYMEKM3hIuq4bAWFsLLKTa9cKbBWeUjE6s+WlDnUOeb4CS4cG52/ORicJ+RaUGd8uE7E4WyZXEF8Ay14r2g1ffiWqbAYWL/WxeHAu4FUU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1628617543540536.2618382057935; Tue, 10 Aug 2021 10:45:43 -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-586-NjAqNt2AOX-2FmXLC4f5qg-1; Tue, 10 Aug 2021 13:45:40 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1C821100A61F; Tue, 10 Aug 2021 17:45:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F171F60C05; Tue, 10 Aug 2021 17:45:33 +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 C18E44A70C; Tue, 10 Aug 2021 17:45:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17AHjNBp025749 for ; Tue, 10 Aug 2021 13:45:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 95B2E69CBB; Tue, 10 Aug 2021 17:45:23 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F4E8620DE for ; Tue, 10 Aug 2021 17:45:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628617542; 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=Yyq0bz7x3mH5hwXguzXFZxUcXvEVx94DXvYswdYZ/kg=; b=SKz46n54lZCTcp3VgfCtNIVbbr2cFT/8iWG3vo12oCSa6pMQjnIqzDBvTWoqzt+0vyBtHH 4JgULmOunVxfsNX0P4t1NGrGSVazzorv6gN7NoZeBK3wrHLaEscuQsKcRluA+S5d2PHIOj YrcyZhVbA0OtkAqJtuB5IhIiP67UZBE= X-MC-Unique: NjAqNt2AOX-2FmXLC4f5qg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 06/10] virsh: cmdCheckpointInfo: delete unused variables Date: Tue, 10 Aug 2021 19:45:05 +0200 Message-Id: <7a8cbfdc2204f061dfe9d81a5112db1c8f17de73.1628617414.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628617544546100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- tools/virsh-checkpoint.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index 2b89f376c9..9e942a226b 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -478,8 +478,6 @@ cmdCheckpointInfo(vshControl *ctl, virDomainCheckpointPtr checkpoint =3D NULL; const char *name; char *parent =3D NULL; - xmlDocPtr xmldoc =3D NULL; - xmlXPathContextPtr ctxt =3D NULL; bool ret =3D false; int count; unsigned int flags; @@ -522,8 +520,6 @@ cmdCheckpointInfo(vshControl *ctl, ret =3D true; =20 cleanup: - xmlXPathFreeContext(ctxt); - xmlFreeDoc(xmldoc); VIR_FREE(parent); virshDomainCheckpointFree(checkpoint); virshDomainFree(dom); --=20 2.31.1 From nobody Wed May 1 23:43:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1628617803; cv=none; d=zohomail.com; s=zohoarc; b=RIYemFRfGAUXXMUPhvE8n7NtNQtXJKSf2sLLiO98eFG3ySsrNhQuqztS448xC62/mWrf60vN2UsHkdaFqcx9kxXrxmMhAM4mmjHbFDK5AfA/NA2BMrnxOz9PZ5FP/W0EMvdkQXbqr1o0Jl+TZkOFYqHIBLD01fH0wxmoOwCVtXc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628617803; 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=LkeN7EsBn5pxlH3mJug52ruCIGDNd/Wh6RNUSuIG4r0=; b=COGAVo3wmopeZW2ywKV1tEFIAmSRkfre1qTVPNE/U+8Ywh/upJt/S1DaH/0XJN9Ndx26N9mr0OCZKOO6C+cnFsFwdoWtLuuc6S1wCBmyWYFQISgdFJ/oz51yD00uD+yJhKNxvAZbNFt8XH1jHTX5tYCNaeLavQQa0hWVpNNtCD4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1628617803416319.2693052931479; Tue, 10 Aug 2021 10:50:03 -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-319-iAtNNdP0N5SFJL4ugUHasw-1; Tue, 10 Aug 2021 13:45:41 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5D4F1100A624; Tue, 10 Aug 2021 17:45:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 388A110016FB; Tue, 10 Aug 2021 17:45: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 0758A4A709; Tue, 10 Aug 2021 17:45:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17AHjO0O025765 for ; Tue, 10 Aug 2021 13:45:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 64E12620DE; Tue, 10 Aug 2021 17:45:24 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id E2C7B6E0B7 for ; Tue, 10 Aug 2021 17:45:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628617802; 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=LkeN7EsBn5pxlH3mJug52ruCIGDNd/Wh6RNUSuIG4r0=; b=IyRPuoc2l1v7/T/eXJrLYzh5ytRuJJZHdyVBIgrrDK5oHHIxYQlvcXUoSgHhwO+gUKJaes YLV7T2L85/ObFDmw6ovvxnHR2iEgR3gRrab6spc4SM8ULO5xsAmU8c6KUS/YFAFolJNQnz d8T5mX8OOqGB5YphlVFG7qRCQ59B3rE= X-MC-Unique: iAtNNdP0N5SFJL4ugUHasw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 07/10] virsh: checkpoint: use g_auto where possible Date: Tue, 10 Aug 2021 19:45:06 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628617804163100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- tools/virsh-checkpoint.c | 78 +++++++++++++--------------------------- 1 file changed, 24 insertions(+), 54 deletions(-) diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index 9e942a226b..5c1d25ecf8 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -47,7 +47,7 @@ virshCheckpointCreate(vshControl *ctl, const char *from) { bool ret =3D false; - virDomainCheckpointPtr checkpoint; + g_autoptr(virshDomainCheckpoint) checkpoint =3D NULL; const char *name =3D NULL; =20 checkpoint =3D virDomainCheckpointCreateXML(dom, buffer, flags); @@ -70,7 +70,6 @@ virshCheckpointCreate(vshControl *ctl, ret =3D true; =20 cleanup: - virshDomainCheckpointFree(checkpoint); return ret; } =20 @@ -114,10 +113,10 @@ static bool cmdCheckpointCreate(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; bool ret =3D false; const char *from =3D NULL; - char *buffer =3D NULL; + g_autofree char *buffer =3D NULL; unsigned int flags =3D 0; =20 VSH_REQUIRE_OPTION("redefine-validate", "redefine"); @@ -146,9 +145,6 @@ cmdCheckpointCreate(vshControl *ctl, ret =3D virshCheckpointCreate(ctl, dom, buffer, flags, from); =20 cleanup: - VIR_FREE(buffer); - virshDomainFree(dom); - return ret; } =20 @@ -165,7 +161,7 @@ virshParseCheckpointDiskspec(vshControl *ctl, const char *name =3D NULL; const char *checkpoint =3D NULL; const char *bitmap =3D NULL; - char **array =3D NULL; + g_auto(GStrv) array =3D NULL; int narray; size_t i; =20 @@ -193,7 +189,6 @@ virshParseCheckpointDiskspec(vshControl *ctl, cleanup: if (ret < 0) vshError(ctl, _("unable to parse diskspec: %s"), str); - g_strfreev(array); return ret; } =20 @@ -238,9 +233,9 @@ static bool cmdCheckpointCreateAs(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; bool ret =3D false; - char *buffer =3D NULL; + g_autofree char *buffer =3D NULL; const char *name =3D NULL; const char *desc =3D NULL; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; @@ -286,9 +281,6 @@ cmdCheckpointCreateAs(vshControl *ctl, ret =3D virshCheckpointCreate(ctl, dom, buffer, flags, NULL); =20 cleanup: - VIR_FREE(buffer); - virshDomainFree(dom); - return ret; } =20 @@ -353,9 +345,9 @@ static bool cmdCheckpointEdit(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom =3D NULL; - virDomainCheckpointPtr checkpoint =3D NULL; - virDomainCheckpointPtr edited =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; + g_autoptr(virshDomainCheckpoint) checkpoint =3D NULL; + g_autoptr(virshDomainCheckpoint) edited =3D NULL; const char *name =3D NULL; const char *edited_name; bool ret =3D false; @@ -404,9 +396,6 @@ cmdCheckpointEdit(vshControl *ctl, cleanup: if (!ret && name) vshError(ctl, _("Failed to update %s"), name); - virshDomainCheckpointFree(edited); - virshDomainCheckpointFree(checkpoint); - virshDomainFree(dom); return ret; } =20 @@ -420,7 +409,7 @@ virshGetCheckpointParent(vshControl *ctl, virDomainCheckpointPtr checkpoint, char **parent_name) { - virDomainCheckpointPtr parent =3D NULL; + g_autoptr(virshDomainCheckpoint) parent =3D NULL; int ret =3D -1; =20 *parent_name =3D NULL; @@ -441,7 +430,6 @@ virshGetCheckpointParent(vshControl *ctl, } else { vshResetLibvirtError(); } - virshDomainCheckpointFree(parent); return ret; } =20 @@ -474,10 +462,10 @@ static bool cmdCheckpointInfo(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom; - virDomainCheckpointPtr checkpoint =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; + g_autoptr(virshDomainCheckpoint) checkpoint =3D NULL; const char *name; - char *parent =3D NULL; + g_autofree char *parent =3D NULL; bool ret =3D false; int count; unsigned int flags; @@ -520,9 +508,6 @@ cmdCheckpointInfo(vshControl *ctl, ret =3D true; =20 cleanup: - VIR_FREE(parent); - virshDomainCheckpointFree(checkpoint); - virshDomainFree(dom); return ret; } =20 @@ -708,7 +693,7 @@ static bool cmdCheckpointList(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; bool ret =3D false; unsigned int flags =3D 0; size_t i; @@ -721,9 +706,9 @@ cmdCheckpointList(vshControl *ctl, bool parent =3D vshCommandOptBool(cmd, "parent"); bool roots =3D vshCommandOptBool(cmd, "roots"); const char *from_chk =3D NULL; - virDomainCheckpointPtr start =3D NULL; + g_autoptr(virshDomainCheckpoint) start =3D NULL; struct virshCheckpointList *checkpointlist =3D NULL; - vshTable *table =3D NULL; + g_autoptr(vshTable) table =3D NULL; =20 VSH_EXCLUSIVE_OPTIONS_VAR(tree, name); VSH_EXCLUSIVE_OPTIONS_VAR(parent, roots); @@ -847,10 +832,6 @@ cmdCheckpointList(vshControl *ctl, =20 cleanup: virshCheckpointListFree(checkpointlist); - virshDomainCheckpointFree(start); - virshDomainFree(dom); - vshTableFree(table); - return ret; } =20 @@ -894,11 +875,11 @@ static bool cmdCheckpointDumpXML(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; bool ret =3D false; const char *name =3D NULL; - virDomainCheckpointPtr checkpoint =3D NULL; - char *xml =3D NULL; + g_autoptr(virshDomainCheckpoint) checkpoint =3D NULL; + g_autofree char *xml =3D NULL; unsigned int flags =3D 0; =20 if (vshCommandOptBool(cmd, "security-info")) @@ -922,10 +903,6 @@ cmdCheckpointDumpXML(vshControl *ctl, ret =3D true; =20 cleanup: - VIR_FREE(xml); - virshDomainCheckpointFree(checkpoint); - virshDomainFree(dom); - return ret; } =20 @@ -957,11 +934,11 @@ static bool cmdCheckpointParent(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; bool ret =3D false; const char *name =3D NULL; - virDomainCheckpointPtr checkpoint =3D NULL; - char *parent =3D NULL; + g_autoptr(virshDomainCheckpoint) checkpoint =3D NULL; + g_autofree char *parent =3D NULL; =20 dom =3D virshCommandOptDomain(ctl, cmd, NULL); if (dom =3D=3D NULL) @@ -983,10 +960,6 @@ cmdCheckpointParent(vshControl *ctl, ret =3D true; =20 cleanup: - VIR_FREE(parent); - virshDomainCheckpointFree(checkpoint); - virshDomainFree(dom); - return ret; } =20 @@ -1031,10 +1004,10 @@ static bool cmdCheckpointDelete(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; bool ret =3D false; const char *name =3D NULL; - virDomainCheckpointPtr checkpoint =3D NULL; + g_autoptr(virshDomainCheckpoint) checkpoint =3D NULL; unsigned int flags =3D 0; =20 dom =3D virshCommandOptDomain(ctl, cmd, NULL); @@ -1065,9 +1038,6 @@ cmdCheckpointDelete(vshControl *ctl, ret =3D true; =20 cleanup: - virshDomainCheckpointFree(checkpoint); - virshDomainFree(dom); - return ret; } =20 --=20 2.31.1 From nobody Wed May 1 23:43:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1628617573; cv=none; d=zohomail.com; s=zohoarc; b=kFlMT/Nb03rjcPtTYPf8q1TU80t9wKeJIRIJxp3/9PqLbEtUu8NvcLZvbAuQN/ljJkiysPf6Za0mtUjW6G8ZiGBrYWLWjMZ+C+pLZx/Gr4w90xWKjZAIIbbaf5jpyC/nDzD6Yw24A+5zTaOF6HXP9CJ/KXKAQHB6hk4KArpXdcs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628617573; 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=ItRy3gFRXO4ctK3LSlelknQlq8ZyJJIfvVNH/4T0cfo=; b=PGPL5JyruOLDY6S2VYxvHC/Jl1lMZQr93A0H4xPAy1KJFQQ/ZJAL7ubO8AeR2p870j+Oj4mS7oelpiAEzmzMt42C7nsW9XWD2F32JgRGwpUk1OSbt9PvBKrtLfAbPsKc4oMsh7AIk4csQGUKl7f7vjH5mMZvsJoML032oIZYFOw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 162861757368616.09084452056163; Tue, 10 Aug 2021 10:46:13 -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-310-FL1A5vldPqesaWlXmFE1rw-1; Tue, 10 Aug 2021 13:46:10 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C5C89101C8A7; Tue, 10 Aug 2021 17:46:04 +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 9BF8B1042A53; Tue, 10 Aug 2021 17:46:04 +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 98E1A181A2AD; Tue, 10 Aug 2021 17:46:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17AHjP5c025772 for ; Tue, 10 Aug 2021 13:45:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 34C2C69FAD; Tue, 10 Aug 2021 17:45:25 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id B215D620DE for ; Tue, 10 Aug 2021 17:45:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628617572; 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=ItRy3gFRXO4ctK3LSlelknQlq8ZyJJIfvVNH/4T0cfo=; b=gxvnpYM/BQPjhYuSTVU0u8ZyMmLNbeX5SrA+ODwEXSUwluz66/3lXiRPCUXKMfmBxB48zy jHopIDHs7sCXc9If01eZvicqsFiUBhhIpM1gI8M2dXrxAudup/4EVonTdRDdHBynn2Fu+i 1hAtelUwsRcreR8C63yJOQR8ZAbSZ+s= X-MC-Unique: FL1A5vldPqesaWlXmFE1rw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 08/10] virsh: checkpoint: remove pointless cleanup labels Date: Tue, 10 Aug 2021 19:45:07 +0200 Message-Id: <9a94a75a411b358730fa1f137dc9ddf0a3529bd1.1628617414.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628617574281100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- tools/virsh-checkpoint.c | 87 ++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 58 deletions(-) diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index 5c1d25ecf8..1f3a318014 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -46,19 +46,18 @@ virshCheckpointCreate(vshControl *ctl, unsigned int flags, const char *from) { - bool ret =3D false; g_autoptr(virshDomainCheckpoint) checkpoint =3D NULL; const char *name =3D NULL; =20 checkpoint =3D virDomainCheckpointCreateXML(dom, buffer, flags); =20 if (checkpoint =3D=3D NULL) - goto cleanup; + return false; =20 name =3D virDomainCheckpointGetName(checkpoint); if (!name) { vshError(ctl, "%s", _("Could not get checkpoint name")); - goto cleanup; + return false; } =20 if (from) @@ -67,10 +66,7 @@ virshCheckpointCreate(vshControl *ctl, else vshPrintExtra(ctl, _("Domain checkpoint %s created"), name); =20 - ret =3D true; - - cleanup: - return ret; + return true; } =20 =20 @@ -114,7 +110,6 @@ cmdCheckpointCreate(vshControl *ctl, const vshCmd *cmd) { g_autoptr(virshDomain) dom =3D NULL; - bool ret =3D false; const char *from =3D NULL; g_autofree char *buffer =3D NULL; unsigned int flags =3D 0; @@ -129,23 +124,20 @@ cmdCheckpointCreate(vshControl *ctl, flags |=3D VIR_DOMAIN_CHECKPOINT_CREATE_QUIESCE; =20 if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) - goto cleanup; + return false; =20 if (vshCommandOptStringReq(ctl, cmd, "xmlfile", &from) < 0) - goto cleanup; + return false; if (!from) { buffer =3D g_strdup(""); } else { if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0) { vshSaveLibvirtError(); - goto cleanup; + return false; } } =20 - ret =3D virshCheckpointCreate(ctl, dom, buffer, flags, from); - - cleanup: - return ret; + return virshCheckpointCreate(ctl, dom, buffer, flags, from); } =20 =20 @@ -234,7 +226,6 @@ cmdCheckpointCreateAs(vshControl *ctl, const vshCmd *cmd) { g_autoptr(virshDomain) dom =3D NULL; - bool ret =3D false; g_autofree char *buffer =3D NULL; const char *name =3D NULL; const char *desc =3D NULL; @@ -250,7 +241,7 @@ cmdCheckpointCreateAs(vshControl *ctl, =20 if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0 || vshCommandOptStringReq(ctl, cmd, "description", &desc) < 0) - goto cleanup; + return false; =20 virBufferAddLit(&buf, "\n"); virBufferAdjustIndent(&buf, 2); @@ -262,7 +253,7 @@ cmdCheckpointCreateAs(vshControl *ctl, virBufferAdjustIndent(&buf, 2); while ((opt =3D vshCommandOptArgv(ctl, cmd, opt))) { if (virshParseCheckpointDiskspec(ctl, &buf, opt->data) < 0) - goto cleanup; + return false; } virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "\n"); @@ -274,14 +265,10 @@ cmdCheckpointCreateAs(vshControl *ctl, =20 if (vshCommandOptBool(cmd, "print-xml")) { vshPrint(ctl, "%s\n", buffer); - ret =3D true; - goto cleanup; + return true; } =20 - ret =3D virshCheckpointCreate(ctl, dom, buffer, flags, NULL); - - cleanup: - return ret; + return virshCheckpointCreate(ctl, dom, buffer, flags, NULL); } =20 =20 @@ -466,7 +453,6 @@ cmdCheckpointInfo(vshControl *ctl, g_autoptr(virshDomainCheckpoint) checkpoint =3D NULL; const char *name; g_autofree char *parent =3D NULL; - bool ret =3D false; int count; unsigned int flags; =20 @@ -476,7 +462,7 @@ cmdCheckpointInfo(vshControl *ctl, =20 if (virshLookupCheckpoint(ctl, cmd, "checkpointname", dom, &checkpoint, &name) < 0) - goto cleanup; + return false; =20 vshPrint(ctl, "%-15s %s\n", _("Name:"), name); vshPrint(ctl, "%-15s %s\n", _("Domain:"), virDomainGetName(dom)); @@ -484,7 +470,7 @@ cmdCheckpointInfo(vshControl *ctl, if (virshGetCheckpointParent(ctl, checkpoint, &parent) < 0) { vshError(ctl, "%s", _("unexpected problem querying checkpoint state")); - goto cleanup; + return false; } vshPrint(ctl, "%-15s %s\n", _("Parent:"), parent ? parent : "-"); =20 @@ -494,21 +480,18 @@ cmdCheckpointInfo(vshControl *ctl, if (count < 0) { if (last_error->code =3D=3D VIR_ERR_NO_SUPPORT) { vshResetLibvirtError(); - ret =3D true; + return true; } - goto cleanup; + return false; } vshPrint(ctl, "%-15s %d\n", _("Children:"), count); flags =3D VIR_DOMAIN_CHECKPOINT_LIST_DESCENDANTS; count =3D virDomainCheckpointListAllChildren(checkpoint, NULL, flags); if (count < 0) - goto cleanup; + return false; vshPrint(ctl, "%-15s %d\n", _("Descendants:"), count); =20 - ret =3D true; - - cleanup: - return ret; + return true; } =20 =20 @@ -876,7 +859,6 @@ cmdCheckpointDumpXML(vshControl *ctl, const vshCmd *cmd) { g_autoptr(virshDomain) dom =3D NULL; - bool ret =3D false; const char *name =3D NULL; g_autoptr(virshDomainCheckpoint) checkpoint =3D NULL; g_autofree char *xml =3D NULL; @@ -894,16 +876,13 @@ cmdCheckpointDumpXML(vshControl *ctl, =20 if (virshLookupCheckpoint(ctl, cmd, "checkpointname", dom, &checkpoint, &name) < 0) - goto cleanup; + return false; =20 if (!(xml =3D virDomainCheckpointGetXMLDesc(checkpoint, flags))) - goto cleanup; + return false; =20 vshPrint(ctl, "%s", xml); - ret =3D true; - - cleanup: - return ret; + return true; } =20 =20 @@ -935,32 +914,28 @@ cmdCheckpointParent(vshControl *ctl, const vshCmd *cmd) { g_autoptr(virshDomain) dom =3D NULL; - bool ret =3D false; const char *name =3D NULL; g_autoptr(virshDomainCheckpoint) checkpoint =3D NULL; g_autofree char *parent =3D NULL; =20 dom =3D virshCommandOptDomain(ctl, cmd, NULL); if (dom =3D=3D NULL) - goto cleanup; + return false; =20 if (virshLookupCheckpoint(ctl, cmd, "checkpointname", dom, &checkpoint, &name) < 0) - goto cleanup; + return false; =20 if (virshGetCheckpointParent(ctl, checkpoint, &parent) < 0) - goto cleanup; + return false; if (!parent) { vshError(ctl, _("checkpoint '%s' has no parent"), name); - goto cleanup; + return false; } =20 vshPrint(ctl, "%s", parent); =20 - ret =3D true; - - cleanup: - return ret; + return true; } =20 =20 @@ -1005,18 +980,17 @@ cmdCheckpointDelete(vshControl *ctl, const vshCmd *cmd) { g_autoptr(virshDomain) dom =3D NULL; - bool ret =3D false; const char *name =3D NULL; g_autoptr(virshDomainCheckpoint) checkpoint =3D NULL; unsigned int flags =3D 0; =20 dom =3D virshCommandOptDomain(ctl, cmd, NULL); if (dom =3D=3D NULL) - goto cleanup; + return false; =20 if (virshLookupCheckpoint(ctl, cmd, "checkpointname", dom, &checkpoint, &name) < 0) - goto cleanup; + return false; =20 if (vshCommandOptBool(cmd, "children")) flags |=3D VIR_DOMAIN_CHECKPOINT_DELETE_CHILDREN; @@ -1032,13 +1006,10 @@ cmdCheckpointDelete(vshControl *ctl, vshPrintExtra(ctl, _("Domain checkpoint %s deleted\n"), name); } else { vshError(ctl, _("Failed to delete checkpoint %s"), name); - goto cleanup; + return false; } =20 - ret =3D true; - - cleanup: - return ret; + return true; } =20 =20 --=20 2.31.1 From nobody Wed May 1 23:43:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1628617633; cv=none; d=zohomail.com; s=zohoarc; b=igcyoVzTBH+zPJD3jAA07RQQC48dSWM1UneYg6XXkg0GfJUxuNyWg5akJIQ/8uYgZxE277ewwcjS4ox1IsD+TqtWgCzNcg4s2+t9E5JCwcJiBizJc9tJQyN86jCQHoeLTLdfR9n4slGTYOu/f6prVPIpUgZXkREk/9WJKGicDu0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628617633; 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=vYhtQdcjEYsL3GSXsi0HARn/NlSGqyedz7PTGh+BL7k=; b=cd8jxpcfCLBdJMRRNTS6BfJHm581MlGIMfR8Q587bsP0PqCFSUg/x8cr7FFNIy8XRomzTlJdCe9BogV4cgAGhpSjgn5A1onR7eoG6eLbfNmhiwOL17Ya6nt9r0iWaIwqQwFR1GK/93Z+Rpq4h6uCZgXKDYDgSoSKjamU9rdwuho= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1628617633302207.40916064684177; Tue, 10 Aug 2021 10:47:13 -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-563-LjWtMW8kO3y6PwdLbqzH_Q-1; Tue, 10 Aug 2021 13:46:15 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 030F7C7441; Tue, 10 Aug 2021 17:46:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CFA4110429CA; Tue, 10 Aug 2021 17:46:06 +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 987A74A713; Tue, 10 Aug 2021 17:46:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17AHjQNo025777 for ; Tue, 10 Aug 2021 13:45:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0448469CBB; Tue, 10 Aug 2021 17:45:26 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 81C83620DE for ; Tue, 10 Aug 2021 17:45:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628617632; 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=vYhtQdcjEYsL3GSXsi0HARn/NlSGqyedz7PTGh+BL7k=; b=ZHJoMKZOkDJhQ6hecpmNaX/8bLxSXsuuXSMEooyeWSEuL20Qa0WYsVA+3yxD+X+l2SEti6 5PxAY16l6+r33jP39KniBNW3/t2e9lntFO7mcUD0Q2T1duq/jTmVlJYbkvHpD+1JTt60HZ T9ya+1TaWvYr8xfo3fH31NpyQzY8nx0= X-MC-Unique: LjWtMW8kO3y6PwdLbqzH_Q-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 09/10] virsh: snapshot: use g_auto where possible Date: Tue, 10 Aug 2021 19:45:08 +0200 Message-Id: <72bdb3f8a619e7c535190fb82c4f088496b02713.1628617414.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628617634640100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- tools/virsh-snapshot.c | 135 +++++++++++++---------------------------- 1 file changed, 43 insertions(+), 92 deletions(-) diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 350f9e803c..889959640d 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -42,7 +42,7 @@ virshSnapshotCreate(vshControl *ctl, virDomainPtr dom, co= nst char *buffer, unsigned int flags, const char *from) { bool ret =3D false; - virDomainSnapshotPtr snapshot; + g_autoptr(virshDomainSnapshot) snapshot =3D NULL; bool halt =3D false; const char *name =3D NULL; =20 @@ -99,7 +99,6 @@ virshSnapshotCreate(vshControl *ctl, virDomainPtr dom, co= nst char *buffer, ret =3D true; =20 cleanup: - virshDomainSnapshotFree(snapshot); return ret; } =20 @@ -162,10 +161,10 @@ static const vshCmdOptDef opts_snapshot_create[] =3D { static bool cmdSnapshotCreate(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; bool ret =3D false; const char *from =3D NULL; - char *buffer =3D NULL; + g_autofree char *buffer =3D NULL; unsigned int flags =3D 0; =20 if (vshCommandOptBool(cmd, "redefine")) @@ -206,9 +205,6 @@ cmdSnapshotCreate(vshControl *ctl, const vshCmd *cmd) ret =3D virshSnapshotCreate(ctl, dom, buffer, flags, from); =20 cleanup: - VIR_FREE(buffer); - virshDomainFree(dom); - return ret; } =20 @@ -221,7 +217,7 @@ virshParseSnapshotMemspec(vshControl *ctl, virBuffer *b= uf, const char *str) int ret =3D -1; const char *snapshot =3D NULL; const char *file =3D NULL; - char **array =3D NULL; + g_auto(GStrv) array =3D NULL; int narray; size_t i; =20 @@ -251,7 +247,6 @@ virshParseSnapshotMemspec(vshControl *ctl, virBuffer *b= uf, const char *str) cleanup: if (ret < 0) vshError(ctl, _("unable to parse memspec: %s"), str); - g_strfreev(array); return ret; } =20 @@ -264,7 +259,7 @@ virshParseSnapshotDiskspec(vshControl *ctl, virBuffer *= buf, const char *str) const char *driver =3D NULL; const char *stype =3D NULL; const char *file =3D NULL; - char **array =3D NULL; + g_auto(GStrv) array =3D NULL; int narray; size_t i; bool isFile =3D true; @@ -319,7 +314,6 @@ virshParseSnapshotDiskspec(vshControl *ctl, virBuffer *= buf, const char *str) cleanup: if (ret < 0) vshError(ctl, _("unable to parse diskspec: %s"), str); - g_strfreev(array); return ret; } =20 @@ -391,9 +385,9 @@ static const vshCmdOptDef opts_snapshot_create_as[] =3D= { static bool cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; bool ret =3D false; - char *buffer =3D NULL; + g_autofree char *buffer =3D NULL; const char *name =3D NULL; const char *desc =3D NULL; const char *memspec =3D NULL; @@ -460,9 +454,6 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd) ret =3D virshSnapshotCreate(ctl, dom, buffer, flags, NULL); =20 cleanup: - VIR_FREE(buffer); - virshDomainFree(dom); - return ret; } =20 @@ -538,9 +529,9 @@ static const vshCmdOptDef opts_snapshot_edit[] =3D { static bool cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom =3D NULL; - virDomainSnapshotPtr snapshot =3D NULL; - virDomainSnapshotPtr edited =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; + g_autoptr(virshDomainSnapshot) snapshot =3D NULL; + g_autoptr(virshDomainSnapshot) edited =3D NULL; const char *name =3D NULL; const char *edited_name; bool ret =3D false; @@ -610,9 +601,6 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd) cleanup: if (!ret && name) vshError(ctl, _("Failed to update %s"), name); - virshDomainSnapshotFree(edited); - virshDomainSnapshotFree(snapshot); - virshDomainFree(dom); return ret; } =20 @@ -650,11 +638,11 @@ static const vshCmdOptDef opts_snapshot_current[] =3D= { static bool cmdSnapshotCurrent(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; bool ret =3D false; int current; - virDomainSnapshotPtr snapshot =3D NULL; - char *xml =3D NULL; + g_autoptr(virshDomainSnapshot) snapshot =3D NULL; + g_autofree char *xml =3D NULL; const char *snapshotname =3D NULL; unsigned int flags =3D 0; const char *domname; @@ -671,7 +659,7 @@ cmdSnapshotCurrent(vshControl *ctl, const vshCmd *cmd) goto cleanup; =20 if (snapshotname) { - virDomainSnapshotPtr snapshot2 =3D NULL; + g_autoptr(virshDomainSnapshot) snapshot2 =3D NULL; flags =3D (VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE | VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT); =20 @@ -689,7 +677,6 @@ cmdSnapshotCurrent(vshControl *ctl, const vshCmd *cmd) if (!(snapshot2 =3D virDomainSnapshotCreateXML(dom, xml, flags))) goto cleanup; =20 - virshDomainSnapshotFree(snapshot2); vshPrintExtra(ctl, _("Snapshot %s set as current"), snapshotname); ret =3D true; goto cleanup; @@ -724,10 +711,6 @@ cmdSnapshotCurrent(vshControl *ctl, const vshCmd *cmd) cleanup: if (!ret) vshReportError(ctl); - VIR_FREE(xml); - virshDomainSnapshotFree(snapshot); - virshDomainFree(dom); - return ret; } =20 @@ -739,10 +722,10 @@ static int virshGetSnapshotParent(vshControl *ctl, virDomainSnapshotPtr snapshot, char **parent_name) { - virDomainSnapshotPtr parent =3D NULL; - char *xml =3D NULL; - xmlDocPtr xmldoc =3D NULL; - xmlXPathContextPtr ctxt =3D NULL; + g_autoptr(virshDomainSnapshot) parent =3D NULL; + g_autofree char *xml =3D NULL; + g_autoptr(xmlDoc) xmldoc =3D NULL; + g_autoptr(xmlXPathContext) ctxt =3D NULL; int ret =3D -1; virshControl *priv =3D ctl->privData; =20 @@ -784,10 +767,6 @@ virshGetSnapshotParent(vshControl *ctl, virDomainSnaps= hotPtr snapshot, } else { vshResetLibvirtError(); } - virshDomainSnapshotFree(parent); - xmlXPathFreeContext(ctxt); - xmlFreeDoc(xmldoc); - VIR_FREE(xml); return ret; } =20 @@ -799,11 +778,11 @@ static int virshSnapshotFilter(vshControl *ctl, virDomainSnapshotPtr snapshot, unsigned int flags) { - char *xml =3D NULL; - xmlDocPtr xmldoc =3D NULL; - xmlXPathContextPtr ctxt =3D NULL; + g_autofree char *xml =3D NULL; + g_autoptr(xmlDoc) xmldoc =3D NULL; + g_autoptr(xmlXPathContext) ctxt =3D NULL; int ret =3D -1; - char *state =3D NULL; + g_autofree char *state =3D NULL; =20 if (!snapshot) return 1; @@ -841,10 +820,6 @@ virshSnapshotFilter(vshControl *ctl, virDomainSnapshot= Ptr snapshot, } =20 cleanup: - VIR_FREE(state); - xmlXPathFreeContext(ctxt); - xmlFreeDoc(xmldoc); - VIR_FREE(xml); return ret; } =20 @@ -875,15 +850,15 @@ static const vshCmdOptDef opts_snapshot_info[] =3D { static bool cmdSnapshotInfo(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom; - virDomainSnapshotPtr snapshot =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; + g_autoptr(virshDomainSnapshot) snapshot =3D NULL; const char *name; - char *doc =3D NULL; - xmlDocPtr xmldoc =3D NULL; - xmlXPathContextPtr ctxt =3D NULL; - char *state =3D NULL; + g_autofree char *doc =3D NULL; + g_autoptr(xmlDoc) xmldoc =3D NULL; + g_autoptr(xmlXPathContext) ctxt =3D NULL; + g_autofree char *state =3D NULL; int external; - char *parent =3D NULL; + g_autofree char *parent =3D NULL; bool ret =3D false; int count; unsigned int flags; @@ -906,14 +881,13 @@ cmdSnapshotInfo(vshControl *ctl, const vshCmd *cmd) * attempt a fallback. */ current =3D virDomainSnapshotIsCurrent(snapshot, 0); if (current < 0) { - virDomainSnapshotPtr other =3D virDomainSnapshotCurrent(dom, 0); + g_autoptr(virshDomainSnapshot) other =3D NULL; =20 vshResetLibvirtError(); current =3D 0; if (other) { if (STREQ(name, virDomainSnapshotGetName(other))) current =3D 1; - virshDomainSnapshotFree(other); } } vshPrint(ctl, "%-15s %s\n", _("Current:"), @@ -1007,13 +981,6 @@ cmdSnapshotInfo(vshControl *ctl, const vshCmd *cmd) ret =3D true; =20 cleanup: - VIR_FREE(state); - xmlXPathFreeContext(ctxt); - xmlFreeDoc(xmldoc); - VIR_FREE(doc); - VIR_FREE(parent); - virshDomainSnapshotFree(snapshot); - virshDomainFree(dom); return ret; } =20 @@ -1486,7 +1453,7 @@ static const vshCmdOptDef opts_snapshot_list[] =3D { static bool cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; bool ret =3D false; unsigned int flags =3D 0; size_t i; @@ -1500,9 +1467,9 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) bool roots =3D vshCommandOptBool(cmd, "roots"); bool current =3D vshCommandOptBool(cmd, "current"); const char *from_snap =3D NULL; - virDomainSnapshotPtr start =3D NULL; + g_autoptr(virshDomainSnapshot) start =3D NULL; struct virshSnapshotList *snaplist =3D NULL; - vshTable *table =3D NULL; + g_autoptr(vshTable) table =3D NULL; =20 VSH_EXCLUSIVE_OPTIONS_VAR(tree, name); VSH_EXCLUSIVE_OPTIONS_VAR(parent, roots); @@ -1642,10 +1609,6 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) =20 cleanup: virshSnapshotListFree(snaplist); - virshDomainSnapshotFree(start); - virshDomainFree(dom); - vshTableFree(table); - return ret; } =20 @@ -1680,11 +1643,11 @@ static const vshCmdOptDef opts_snapshot_dumpxml[] = =3D { static bool cmdSnapshotDumpXML(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; bool ret =3D false; const char *name =3D NULL; - virDomainSnapshotPtr snapshot =3D NULL; - char *xml =3D NULL; + g_autoptr(virshDomainSnapshot) snapshot =3D NULL; + g_autofree char *xml =3D NULL; unsigned int flags =3D 0; =20 if (vshCommandOptBool(cmd, "security-info")) @@ -1706,10 +1669,6 @@ cmdSnapshotDumpXML(vshControl *ctl, const vshCmd *cm= d) ret =3D true; =20 cleanup: - VIR_FREE(xml); - virshDomainSnapshotFree(snapshot); - virshDomainFree(dom); - return ret; } =20 @@ -1740,11 +1699,11 @@ static const vshCmdOptDef opts_snapshot_parent[] = =3D { static bool cmdSnapshotParent(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; bool ret =3D false; const char *name =3D NULL; - virDomainSnapshotPtr snapshot =3D NULL; - char *parent =3D NULL; + g_autoptr(virshDomainSnapshot) snapshot =3D NULL; + g_autofree char *parent =3D NULL; =20 dom =3D virshCommandOptDomain(ctl, cmd, NULL); if (dom =3D=3D NULL) @@ -1766,10 +1725,6 @@ cmdSnapshotParent(vshControl *ctl, const vshCmd *cmd) ret =3D true; =20 cleanup: - VIR_FREE(parent); - virshDomainSnapshotFree(snapshot); - virshDomainFree(dom); - return ret; } =20 @@ -1812,10 +1767,10 @@ static const vshCmdOptDef opts_snapshot_revert[] = =3D { static bool cmdDomainSnapshotRevert(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; bool ret =3D false; const char *name =3D NULL; - virDomainSnapshotPtr snapshot =3D NULL; + g_autoptr(virshDomainSnapshot) snapshot =3D NULL; unsigned int flags =3D 0; bool force =3D false; int result; @@ -1852,8 +1807,6 @@ cmdDomainSnapshotRevert(vshControl *ctl, const vshCmd= *cmd) ret =3D true; =20 cleanup: - virshDomainSnapshotFree(snapshot); - virshDomainFree(dom); =20 return ret; } @@ -1897,10 +1850,10 @@ static const vshCmdOptDef opts_snapshot_delete[] = =3D { static bool cmdSnapshotDelete(vshControl *ctl, const vshCmd *cmd) { - virDomainPtr dom =3D NULL; + g_autoptr(virshDomain) dom =3D NULL; bool ret =3D false; const char *name =3D NULL; - virDomainSnapshotPtr snapshot =3D NULL; + g_autoptr(virshDomainSnapshot) snapshot =3D NULL; unsigned int flags =3D 0; =20 dom =3D virshCommandOptDomain(ctl, cmd, NULL); @@ -1934,8 +1887,6 @@ cmdSnapshotDelete(vshControl *ctl, const vshCmd *cmd) ret =3D true; =20 cleanup: - virshDomainSnapshotFree(snapshot); - virshDomainFree(dom); =20 return ret; } --=20 2.31.1 From nobody Wed May 1 23:43:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1628617626; cv=none; d=zohomail.com; s=zohoarc; b=WERj9U5MEscb7yR73Wjl8lClsGzRPNG0mkTJWKrdrbkZOB3KhRF4ymCtxzySs1jkz4KjfnPaOBS1FfRy8d6FaFhXp5xXH6N23ERq9bEqg7jqWn8eZhtpno6MGGtQwSXYO6WZT0pFeDto4JS70Z3h/Z1r2N2vVcpkRSGs+QZ7l24= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628617626; 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=eW2nz8dsc7/jlse07mZfAvDXyzPLvYJuiQxDrvVcRVY=; b=SHrEZaJF2S+yMyoJK8qwnHy8pMJ+D2IbFTchBtkZQv+6A87crEy9peO07H/AtPfocBiTBrypyB7KHBZqNtm22+OPmm4CXoUWu0pruib1Wj79HrPKtYwmOU2mxXaSjfUj7wijZoXE92kBN4V350Uq78rOsRr6xiwzULKdy/Yydok= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1628617626899359.31023362788187; Tue, 10 Aug 2021 10:47:06 -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-142-9I8U-naFN1y6-ZHj8P-pKw-1; Tue, 10 Aug 2021 13:45:43 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1CAEB802937; Tue, 10 Aug 2021 17:45:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EB65A5D6A8; Tue, 10 Aug 2021 17:45:36 +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 B710A4A70F; Tue, 10 Aug 2021 17:45:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17AHjQT2025785 for ; Tue, 10 Aug 2021 13:45:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id C8546620DE; Tue, 10 Aug 2021 17:45:26 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 516646E0B7 for ; Tue, 10 Aug 2021 17:45:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628617625; 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=eW2nz8dsc7/jlse07mZfAvDXyzPLvYJuiQxDrvVcRVY=; b=bXM1dCA7orGAqyW/vEFJfGJz/qiTTdOCE3ql1KfUlyiBg79fpJJV1DCGLvw+1c3lznMK4c FE6+vh5Y45ljIzdQzixMsMKOnOTZg9Z+ukag49xpY4+oCS8yN5UxO3HRjCRMuFoK9BIh7o qxVLyL9yBbUit+6sCOdXkjiMVoeOiWs= X-MC-Unique: 9I8U-naFN1y6-ZHj8P-pKw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 10/10] virsh: snapshot: remove pointless cleanup labels Date: Tue, 10 Aug 2021 19:45:09 +0200 Message-Id: <5d8beecb3ea8411f78e271db21c03b276366525c.1628617414.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628617628406100003 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- tools/virsh-snapshot.c | 130 +++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 84 deletions(-) diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 889959640d..ee99d0e061 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -41,7 +41,6 @@ static bool virshSnapshotCreate(vshControl *ctl, virDomainPtr dom, const char *buffer, unsigned int flags, const char *from) { - bool ret =3D false; g_autoptr(virshDomainSnapshot) snapshot =3D NULL; bool halt =3D false; const char *name =3D NULL; @@ -64,12 +63,12 @@ virshSnapshotCreate(vshControl *ctl, virDomainPtr dom, = const char *buffer, persistent =3D virDomainIsPersistent(dom); if (persistent < 0) { vshReportError(ctl); - goto cleanup; + return false; } if (!persistent) { vshError(ctl, "%s", _("cannot halt after snapshot of transient domain")); - goto cleanup; + return false; } if (virDomainIsActive(dom) =3D=3D 1) halt =3D true; @@ -78,17 +77,17 @@ virshSnapshotCreate(vshControl *ctl, virDomainPtr dom, = const char *buffer, } =20 if (snapshot =3D=3D NULL) - goto cleanup; + return false; =20 if (halt && virDomainDestroy(dom) < 0) { vshReportError(ctl); - goto cleanup; + return false; } =20 name =3D virDomainSnapshotGetName(snapshot); if (!name) { vshError(ctl, "%s", _("Could not get snapshot name")); - goto cleanup; + return false; } =20 if (from) @@ -96,10 +95,7 @@ virshSnapshotCreate(vshControl *ctl, virDomainPtr dom, c= onst char *buffer, else vshPrintExtra(ctl, _("Domain snapshot %s created"), name); =20 - ret =3D true; - - cleanup: - return ret; + return true; } =20 /* @@ -162,7 +158,6 @@ static bool cmdSnapshotCreate(vshControl *ctl, const vshCmd *cmd) { g_autoptr(virshDomain) dom =3D NULL; - bool ret =3D false; const char *from =3D NULL; g_autofree char *buffer =3D NULL; unsigned int flags =3D 0; @@ -189,23 +184,20 @@ cmdSnapshotCreate(vshControl *ctl, const vshCmd *cmd) flags |=3D VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE; =20 if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) - goto cleanup; + return false; =20 if (vshCommandOptStringReq(ctl, cmd, "xmlfile", &from) < 0) - goto cleanup; + return false; if (!from) { buffer =3D g_strdup(""); } else { if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0) { vshSaveLibvirtError(); - goto cleanup; + return false; } } =20 - ret =3D virshSnapshotCreate(ctl, dom, buffer, flags, from); - - cleanup: - return ret; + return virshSnapshotCreate(ctl, dom, buffer, flags, from); } =20 /* @@ -386,7 +378,6 @@ static bool cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd) { g_autoptr(virshDomain) dom =3D NULL; - bool ret =3D false; g_autofree char *buffer =3D NULL; const char *name =3D NULL; const char *desc =3D NULL; @@ -417,7 +408,7 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd) =20 if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0 || vshCommandOptStringReq(ctl, cmd, "description", &desc) < 0) - goto cleanup; + return false; =20 virBufferAddLit(&buf, "\n"); virBufferAdjustIndent(&buf, 2); @@ -425,17 +416,17 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cm= d) virBufferEscapeString(&buf, "%s\n", desc); =20 if (vshCommandOptStringReq(ctl, cmd, "memspec", &memspec) < 0) - goto cleanup; + return false; =20 if (memspec && virshParseSnapshotMemspec(ctl, &buf, memspec) < 0) - goto cleanup; + return false; =20 if (vshCommandOptBool(cmd, "diskspec")) { virBufferAddLit(&buf, "\n"); virBufferAdjustIndent(&buf, 2); while ((opt =3D vshCommandOptArgv(ctl, cmd, opt))) { if (virshParseSnapshotDiskspec(ctl, &buf, opt->data) < 0) - goto cleanup; + return false; } virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "\n"); @@ -447,14 +438,10 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cm= d) =20 if (vshCommandOptBool(cmd, "print-xml")) { vshPrint(ctl, "%s\n", buffer); - ret =3D true; - goto cleanup; + return true; } =20 - ret =3D virshSnapshotCreate(ctl, dom, buffer, flags, NULL); - - cleanup: - return ret; + return virshSnapshotCreate(ctl, dom, buffer, flags, NULL); } =20 /* Helper for resolving {--current | --ARG name} into a snapshot @@ -789,11 +776,11 @@ virshSnapshotFilter(vshControl *ctl, virDomainSnapsho= tPtr snapshot, =20 xml =3D virDomainSnapshotGetXMLDesc(snapshot, 0); if (!xml) - goto cleanup; + return -1; =20 xmldoc =3D virXMLParseStringCtxt(xml, _("(domain_snapshot)"), &ctxt); if (!xmldoc) - goto cleanup; + return -1; =20 /* Libvirt 1.0.1 and newer never call this function, because the * filtering is already supported by the listing functions. Older @@ -803,7 +790,7 @@ virshSnapshotFilter(vshControl *ctl, virDomainSnapshotP= tr snapshot, state =3D virXPathString("string(/domainsnapshot/state)", ctxt); if (!state) { vshError(ctl, "%s", _("unable to perform snapshot filtering")); - goto cleanup; + return -1; } if (STREQ(state, "disk-snapshot")) { ret =3D ((flags & (VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY | @@ -819,7 +806,6 @@ virshSnapshotFilter(vshControl *ctl, virDomainSnapshotP= tr snapshot, ret =3D !!(flags & VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE); } =20 - cleanup: return ret; } =20 @@ -859,7 +845,6 @@ cmdSnapshotInfo(vshControl *ctl, const vshCmd *cmd) g_autofree char *state =3D NULL; int external; g_autofree char *parent =3D NULL; - bool ret =3D false; int count; unsigned int flags; int current; @@ -872,7 +857,7 @@ cmdSnapshotInfo(vshControl *ctl, const vshCmd *cmd) =20 if (virshLookupSnapshot(ctl, cmd, "snapshotname", true, dom, &snapshot, &name) < 0) - goto cleanup; + return false; =20 vshPrint(ctl, "%-15s %s\n", _("Name:"), name); vshPrint(ctl, "%-15s %s\n", _("Domain:"), virDomainGetName(dom)); @@ -897,17 +882,17 @@ cmdSnapshotInfo(vshControl *ctl, const vshCmd *cmd) * state of the machine at the time of the snapshot. */ doc =3D virDomainSnapshotGetXMLDesc(snapshot, 0); if (!doc) - goto cleanup; + return false; =20 xmldoc =3D virXMLParseStringCtxt(doc, _("(domain_snapshot)"), &ctxt); if (!xmldoc) - goto cleanup; + return false; =20 state =3D virXPathString("string(/domainsnapshot/state)", ctxt); if (!state) { vshError(ctl, "%s", _("unexpected problem reading snapshot xml")); - goto cleanup; + return false; } vshPrint(ctl, "%-15s %s\n", _("State:"), state); =20 @@ -933,7 +918,7 @@ cmdSnapshotInfo(vshControl *ctl, const vshCmd *cmd) if (external < 0) { vshError(ctl, "%s", _("unexpected problem reading snapshot xml")); - goto cleanup; + return false; } vshPrint(ctl, "%-15s %s\n", _("Location:"), external ? _("external") : _("internal")); @@ -946,24 +931,22 @@ cmdSnapshotInfo(vshControl *ctl, const vshCmd *cmd) /* Children, Descendants. After this point, the fallback to * compute children is too expensive, so we gracefully quit if the * APIs don't exist. */ - if (priv->useSnapshotOld) { - ret =3D true; - goto cleanup; - } + if (priv->useSnapshotOld) + return true; flags =3D 0; count =3D virDomainSnapshotNumChildren(snapshot, flags); if (count < 0) { if (last_error->code =3D=3D VIR_ERR_NO_SUPPORT) { vshResetLibvirtError(); - ret =3D true; + return true; } - goto cleanup; + return false; } vshPrint(ctl, "%-15s %d\n", _("Children:"), count); flags =3D VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS; count =3D virDomainSnapshotNumChildren(snapshot, flags); if (count < 0) - goto cleanup; + return false; vshPrint(ctl, "%-15s %d\n", _("Descendants:"), count); =20 /* Metadata; the fallback here relies on the fact that metadata @@ -978,10 +961,7 @@ cmdSnapshotInfo(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%-15s %s\n", _("Metadata:"), metadata ? _("yes") : _("no")); =20 - ret =3D true; - - cleanup: - return ret; + return true; } =20 /* Helpers for collecting a list of snapshots. */ @@ -1644,7 +1624,6 @@ static bool cmdSnapshotDumpXML(vshControl *ctl, const vshCmd *cmd) { g_autoptr(virshDomain) dom =3D NULL; - bool ret =3D false; const char *name =3D NULL; g_autoptr(virshDomainSnapshot) snapshot =3D NULL; g_autofree char *xml =3D NULL; @@ -1660,16 +1639,13 @@ cmdSnapshotDumpXML(vshControl *ctl, const vshCmd *c= md) return false; =20 if (!(snapshot =3D virDomainSnapshotLookupByName(dom, name, 0))) - goto cleanup; + return false; =20 if (!(xml =3D virDomainSnapshotGetXMLDesc(snapshot, flags))) - goto cleanup; + return false; =20 vshPrint(ctl, "%s", xml); - ret =3D true; - - cleanup: - return ret; + return true; } =20 /* @@ -1700,32 +1676,28 @@ static bool cmdSnapshotParent(vshControl *ctl, const vshCmd *cmd) { g_autoptr(virshDomain) dom =3D NULL; - bool ret =3D false; const char *name =3D NULL; g_autoptr(virshDomainSnapshot) snapshot =3D NULL; g_autofree char *parent =3D NULL; =20 dom =3D virshCommandOptDomain(ctl, cmd, NULL); if (dom =3D=3D NULL) - goto cleanup; + return false; =20 if (virshLookupSnapshot(ctl, cmd, "snapshotname", true, dom, &snapshot, &name) < 0) - goto cleanup; + return false; =20 if (virshGetSnapshotParent(ctl, snapshot, &parent) < 0) - goto cleanup; + return false; if (!parent) { vshError(ctl, _("snapshot '%s' has no parent"), name); - goto cleanup; + return false; } =20 vshPrint(ctl, "%s", parent); =20 - ret =3D true; - - cleanup: - return ret; + return true; } =20 /* @@ -1768,7 +1740,6 @@ static bool cmdDomainSnapshotRevert(vshControl *ctl, const vshCmd *cmd) { g_autoptr(virshDomain) dom =3D NULL; - bool ret =3D false; const char *name =3D NULL; g_autoptr(virshDomainSnapshot) snapshot =3D NULL; unsigned int flags =3D 0; @@ -1788,11 +1759,11 @@ cmdDomainSnapshotRevert(vshControl *ctl, const vshC= md *cmd) =20 dom =3D virshCommandOptDomain(ctl, cmd, NULL); if (dom =3D=3D NULL) - goto cleanup; + return false; =20 if (virshLookupSnapshot(ctl, cmd, "snapshotname", true, dom, &snapshot, &name) < 0) - goto cleanup; + return false; =20 result =3D virDomainRevertToSnapshot(snapshot, flags); if (result < 0 && force && @@ -1802,13 +1773,9 @@ cmdDomainSnapshotRevert(vshControl *ctl, const vshCm= d *cmd) result =3D virDomainRevertToSnapshot(snapshot, flags); } if (result < 0) - goto cleanup; + return false; =20 - ret =3D true; - - cleanup: - - return ret; + return true; } =20 /* @@ -1851,18 +1818,17 @@ static bool cmdSnapshotDelete(vshControl *ctl, const vshCmd *cmd) { g_autoptr(virshDomain) dom =3D NULL; - bool ret =3D false; const char *name =3D NULL; g_autoptr(virshDomainSnapshot) snapshot =3D NULL; unsigned int flags =3D 0; =20 dom =3D virshCommandOptDomain(ctl, cmd, NULL); if (dom =3D=3D NULL) - goto cleanup; + return false; =20 if (virshLookupSnapshot(ctl, cmd, "snapshotname", true, dom, &snapshot, &name) < 0) - goto cleanup; + return false; =20 if (vshCommandOptBool(cmd, "children")) flags |=3D VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN; @@ -1881,14 +1847,10 @@ cmdSnapshotDelete(vshControl *ctl, const vshCmd *cm= d) vshPrintExtra(ctl, _("Domain snapshot %s deleted\n"), name); } else { vshError(ctl, _("Failed to delete snapshot %s"), name); - goto cleanup; + return false; } =20 - ret =3D true; - - cleanup: - - return ret; + return true; } =20 const vshCmdDef snapshotCmds[] =3D { --=20 2.31.1