From nobody Mon Feb 9 11:07:18 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=1606911378; cv=none; d=zohomail.com; s=zohoarc; b=MBPgo9v4EJaB8j3xHZ2BUKi9iBUjpg4O8HLBQ/fi8h/j6fDb0mn8OYfqnwD6iOM+f84OKnfhnUCNz88ZApK0oVERvX/HcHeHuP978MwhpUq4oHGJF/06Qs3QKUK1KFkH9pNeWEDdIEkUDhnoMRtG7fMxJeCXpt6d4EfF/C4iHds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606911378; 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=gcXGnxrqn+UWjY4C9ZF5FghZH8dSY0tLIt60Nk492yc=; b=cCnOIeczxsKwiTLm2PW4Qpz1BEon577zBpmqK0M7MwGzQexDN/awcNec4eURrOHQBMfKbazjBEVoKlnzXVMe/asfejty92ZvDfi5RxW5TN6UzPyLVpRYCEAvWD6ZqQ2EVvjiSUzXJB4mG4wQezv6knzxSUG++QFoUxGSDZeERB8= 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 1606911378788362.04036259933673; Wed, 2 Dec 2020 04:16:18 -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-424-azBlltAUMW6YLJnau_I11Q-1; Wed, 02 Dec 2020 07:15:27 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CFC01100C60D; Wed, 2 Dec 2020 12:15:21 +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 AD47A6086F; Wed, 2 Dec 2020 12:15:21 +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 791BD1809CAA; Wed, 2 Dec 2020 12:15: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 0B2CFKDh031893 for ; Wed, 2 Dec 2020 07:15:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id B44CC189A5; Wed, 2 Dec 2020 12:15:20 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08F7863BA7 for ; Wed, 2 Dec 2020 12:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606911377; 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=gcXGnxrqn+UWjY4C9ZF5FghZH8dSY0tLIt60Nk492yc=; b=f+e3WxH1+gziZD3FL3Zq5jwPvelLYuWqQCCkDRu2fpnx3eeENNjTJylkb5yEteDjS3Jmqo XtYX0ic2ybgvqaoeApwnWp8csieiIcjwycYIZzkkbzsbB7HiNiJlksRgKVQPuO9qZgMoxt uUq2XKxVLd8Tk4VoEnpMrZR43Yb2wyk= X-MC-Unique: azBlltAUMW6YLJnau_I11Q-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/11] virDomainCheckpointAlignDisks: Extract domain disk def pointer to 'domdisk' Date: Wed, 2 Dec 2020 13:14:56 +0100 Message-Id: <3405a80b3b3836ee7c32c07659103f06519605c3.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.13 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" Add a local variable holding the pointer instead of indexing the array multiple times. Signed-off-by: Peter Krempa --- src/conf/checkpoint_conf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c index 22757d148f..3213097f4f 100644 --- a/src/conf/checkpoint_conf.c +++ b/src/conf/checkpoint_conf.c @@ -328,6 +328,7 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr= chkdef) for (i =3D 0; i < chkdef->ndisks; i++) { virDomainCheckpointDiskDefPtr chkdisk =3D &chkdef->disks[i]; int idx =3D virDomainDiskIndexByName(domdef, chkdisk->name, false); + virDomainDiskDefPtr domdisk; if (idx < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -335,14 +336,17 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefP= tr chkdef) return -1; } + domdisk =3D domdef->disks[idx]; + if (virBitmapIsBitSet(map, idx)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk '%s' specified twice"), chkdisk->name); return -1; } - if ((virStorageSourceIsEmpty(domdef->disks[idx]->src) || - domdef->disks[idx]->src->readonly) && + + if ((virStorageSourceIsEmpty(domdisk->src) || + domdisk->src->readonly) && chkdisk->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_NONE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk '%s' is empty or readonly"), @@ -352,9 +356,9 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr= chkdef) ignore_value(virBitmapSetBit(map, idx)); chkdisk->idx =3D idx; - if (STRNEQ(chkdisk->name, domdef->disks[idx]->dst)) { + if (STRNEQ(chkdisk->name, domdisk->dst)) { VIR_FREE(chkdisk->name); - chkdisk->name =3D g_strdup(domdef->disks[idx]->dst); + chkdisk->name =3D g_strdup(domdisk->dst); } } --=20 2.28.0