From nobody Mon Feb 9 07:55:57 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1606911323; cv=none; d=zohomail.com; s=zohoarc; b=EeTv+VUvPGmYDb/36f5PD73pFm9vn1dONAa/3Tvt2U3aJe9e92swnS5GH2CHv3BbN0n5KxIX7ubFgV2mjoUBGT+PotyLT4MkXDccnLWcSwy1AczJssSSoHZj2oE6iW7DEdpXDZVcM0ZSxMqGJk/dTL2JzOTj3RSYv6MaUivoeNo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606911323; 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=ZmU6pgGi7Sr1Cmvg+ctdQHyApjGsI3R42oBaSgUPUw0=; b=WwMKaAQ76JQcXgEWLzJd3Tao6EcVn09MJckEGTPZY3L57ShI7weuJpu+tVbdimeK43DaIgsO5HJTPxN7dk4K76maYnPLG+2eqyXsS+CXLcJqjwDxaR526602CrmV4EETY/VvrmtwyELpAOSNJvIDMsqZZWEciHbxpXLHfgZ+h1k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1606911323520822.9190528619414; Wed, 2 Dec 2020 04:15:23 -0800 (PST) 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-162-VWe7Z2PoOhqosivJKLQ0RA-1; Wed, 02 Dec 2020 07:15:19 -0500 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 C9B8910151F9; Wed, 2 Dec 2020 12:15:13 +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 A3FBA60C6B; Wed, 2 Dec 2020 12:15:13 +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 686311809CA4; Wed, 2 Dec 2020 12:15:13 +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 0B2CF9jV031747 for ; Wed, 2 Dec 2020 07:15:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id B1D4C189B6; Wed, 2 Dec 2020 12:15:09 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17D07189A5 for ; Wed, 2 Dec 2020 12:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606911322; 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=ZmU6pgGi7Sr1Cmvg+ctdQHyApjGsI3R42oBaSgUPUw0=; b=OkN99v14yeCM62zt4gTw2IFXRxjxyIzdx8dy2GhuReGFiQpyinIAlWcoSRQEWgb4ToJo57 ojXHHjwAdfKnG5A23P9NQo6K/R8VUmeIr6LrnQPv01cwOa5JeOW8KNHpFa9Ndh45m6EgkL hRCRkX4QwqdfG6ROTxxZfAZSiQQdSFg= X-MC-Unique: VWe7Z2PoOhqosivJKLQ0RA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 01/11] virDomainCheckpointAlignDisks: Refactor cleanup Date: Wed, 2 Dec 2020 13:14:51 +0100 Message-Id: <55ca728d2f7d42e9dd523c77f00f3a0afccce035.1606911231.git.pkrempa@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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use g_autoptr for virBitmap and get rid of the 'cleanup:' label and ret variable. Signed-off-by: Peter Krempa --- src/conf/checkpoint_conf.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c index a8d18928de..795c6f93c4 100644 --- a/src/conf/checkpoint_conf.c +++ b/src/conf/checkpoint_conf.c @@ -292,8 +292,7 @@ virDomainCheckpointCompareDiskIndex(const void *a, cons= t void *b) int virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr def) { - int ret =3D -1; - virBitmapPtr map =3D NULL; + g_autoptr(virBitmap) map =3D NULL; size_t i; int ndisks; int checkpoint_default =3D VIR_DOMAIN_CHECKPOINT_TYPE_NONE; @@ -301,13 +300,13 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefP= tr def) if (!def->parent.dom) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing domain in checkpoint")); - goto cleanup; + return -1; } if (def->ndisks > def->parent.dom->ndisks) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("too many disk checkpoint requests for domain")); - goto cleanup; + return -1; } /* Unlikely to have a guest without disks but technically possible. */ @@ -315,7 +314,7 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr= def) virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("domain must have at least one disk to perform " "checkpoints")); - goto cleanup; + return -1; } /* If omitted, do bitmap on all writeable disks; @@ -333,14 +332,14 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefP= tr def) if (idx < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("no disk named '%s'"), disk->name); - goto cleanup; + return -1; } if (virBitmapIsBitSet(map, idx)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk '%s' specified twice"), disk->name); - goto cleanup; + return -1; } if ((virStorageSourceIsEmpty(def->parent.dom->disks[idx]->src) || def->parent.dom->disks[idx]->src->readonly) && @@ -348,7 +347,7 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr= def) virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk '%s' is empty or readonly"), disk->name); - goto cleanup; + return -1; } ignore_value(virBitmapSetBit(map, idx)); disk->idx =3D idx; @@ -363,7 +362,7 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr= def) ndisks =3D def->ndisks; if (VIR_EXPAND_N(def->disks, def->ndisks, def->parent.dom->ndisks - def->ndisks) < 0) - goto cleanup; + return -1; for (i =3D 0; i < def->parent.dom->ndisks; i++) { virDomainCheckpointDiskDefPtr disk; @@ -387,13 +386,9 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPt= r def) /* Generate default bitmap names for checkpoint */ if (virDomainCheckpointDefAssignBitmapNames(def) < 0) - goto cleanup; - - ret =3D 0; + return -1; - cleanup: - virBitmapFree(map); - return ret; + return 0; } --=20 2.28.0