From nobody Sun Feb 8 07:52:23 2026 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=1681999417; cv=none; d=zohomail.com; s=zohoarc; b=L3XPtuHBCtsXFtyNwH6kZNltuM9nsqKmZwNTwlqRYxZ1mQD4MiksuvBvuQ/BUGY9q5/ZRBgf3B2ho6WBrSethtOmXqsKMZji3bF9SSxDoLFA5gUJl27C1l8WH+GoUnOVUDvmv1LGXdR8Z02Ixpdh+xxy1+I2hX3gX3uXMHpUBj0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681999417; 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=K2pn91k4NJeXBEyO3TMM8XaTDdrc0/lFBI1QJwegvfs=; b=TDc8s8zSGAvOPS+rOKb5aDqST5rCrU7Xz+TMWnjEJ4sLXrbtehiWuwH3ShK19ggKnzzs0Osk2YPwhseWxZiYs9DBWKBIR4gI4nGdTjuNlwBDFl/vpqaTOoDaYUICdczK5jF6blSbcHDwSjycQ0XYKhq1xRyrB6gD+Yu3h3bBn0w= 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 1681999416969886.8147032034121; Thu, 20 Apr 2023 07:03:36 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-124-xLv-TvmBOpGl2NQrxOa07A-1; Thu, 20 Apr 2023 10:03:27 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CCAE11C17458; Thu, 20 Apr 2023 14:02:23 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id BADBC40C2064; Thu, 20 Apr 2023 14:02:23 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 14F6219452CD; Thu, 20 Apr 2023 14:02:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6CC1A1946A5E for ; Thu, 20 Apr 2023 14:02:21 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5C4AFC16026; Thu, 20 Apr 2023 14:02:21 +0000 (UTC) Received: from hjs.. (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 031E2C16024 for ; Thu, 20 Apr 2023 14:02:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681999415; 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=K2pn91k4NJeXBEyO3TMM8XaTDdrc0/lFBI1QJwegvfs=; b=LDM7EwoacuEHcn07zShzRdw/s3kwZZP9oq+3llE03rXTBjbU8lfNF2C2slOHsv+a01y3RS f+U2UNtTUh3x9WpSWs0BIaAIMGuSqpQ6uf4jS6i4dVZ7tC6YCkynp+cbbXm49awgnxIRP/ YQ6QHyyjad4YDjKnttJbpXharNs2ejY= X-MC-Unique: xLv-TvmBOpGl2NQrxOa07A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 4/4] conf: storage: remove redundant condition Date: Thu, 20 Apr 2023 16:02:16 +0200 Message-Id: <85ef08fbc04c103b7443e1c8ee9ba26aa2e898ea.1681999311.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1681999430512100001 We exit early if poolOptions->formatToString is false. Fixes: 9dadc7302920f9fca0057c655d03c2b0206b9a70 Signed-off-by: J=C3=A1n Tomko --- src/conf/storage_conf.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 3e584ad9b9..68842004b7 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -364,6 +364,7 @@ virStoragePoolOptionsFormatPool(virBuffer *buf, int type) { virStoragePoolOptions *poolOptions; + size_t i; =20 if (!(poolOptions =3D virStoragePoolOptionsForPoolType(type))) return -1; @@ -374,22 +375,17 @@ virStoragePoolOptionsFormatPool(virBuffer *buf, virBufferAddLit(buf, "\n"); virBufferAdjustIndent(buf, 2); =20 - if (poolOptions->formatToString) { - size_t i; + virBufferAsprintf(buf, "\n", + (poolOptions->formatToString)(poolOptions->defaultFo= rmat)); =20 - virBufferAsprintf(buf, "\n", - (poolOptions->formatToString)(poolOptions->defau= ltFormat)); + virBufferAddLit(buf, "\n"); + virBufferAdjustIndent(buf, 2); =20 - virBufferAddLit(buf, "\n"); - virBufferAdjustIndent(buf, 2); + for (i =3D 0; i < poolOptions->lastFormat; i++) + virBufferAsprintf(buf, "%s\n", (poolOptions->format= ToString)(i)); =20 - for (i =3D 0; i < poolOptions->lastFormat; i++) - virBufferAsprintf(buf, "%s\n", - (poolOptions->formatToString)(i)); - - virBufferAdjustIndent(buf, -2); - virBufferAddLit(buf, "\n"); - } + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); =20 virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); --=20 2.39.2