From: Ján Tomko Date: Thu, 20 Apr 2023 13:57:24 +0000 (+0200) Subject: conf: storage: remove redundant condition X-Git-Tag: v9.3.0-rc1~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d063389f10707a6694fb98a69f403a63e4d22245;p=thirdparty%2Flibvirt.git conf: storage: remove redundant condition We exit early if poolOptions->formatToString is false. Fixes: 9dadc7302920f9fca0057c655d03c2b0206b9a70 Signed-off-by: Ján Tomko Reviewed-by: Pavel Hrdina --- 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; if (!(poolOptions = virStoragePoolOptionsForPoolType(type))) return -1; @@ -374,22 +375,17 @@ virStoragePoolOptionsFormatPool(virBuffer *buf, virBufferAddLit(buf, "\n"); virBufferAdjustIndent(buf, 2); - if (poolOptions->formatToString) { - size_t i; - - virBufferAsprintf(buf, "\n", - (poolOptions->formatToString)(poolOptions->defaultFormat)); + virBufferAsprintf(buf, "\n", + (poolOptions->formatToString)(poolOptions->defaultFormat)); - virBufferAddLit(buf, "\n"); - virBufferAdjustIndent(buf, 2); + virBufferAddLit(buf, "\n"); + virBufferAdjustIndent(buf, 2); - for (i = 0; i < poolOptions->lastFormat; i++) - virBufferAsprintf(buf, "%s\n", - (poolOptions->formatToString)(i)); + for (i = 0; i < poolOptions->lastFormat; i++) + virBufferAsprintf(buf, "%s\n", (poolOptions->formatToString)(i)); - virBufferAdjustIndent(buf, -2); - virBufferAddLit(buf, "\n"); - } + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n");