diff options
author | Ján Tomko <jtomko@redhat.com> | 2023-04-20 15:57:24 +0200 |
---|---|---|
committer | Ján Tomko <jtomko@redhat.com> | 2023-04-20 17:28:34 +0200 |
commit | d063389f10707a6694fb98a69f403a63e4d22245 (patch) | |
tree | 19710ad050c816980ab7520897aeaad2b51f099b | |
parent | 6e48e024754819886e8b1fde255e3cb2ee77a733 (diff) | |
download | libvirt-d063389f10707a6694fb98a69f403a63e4d22245.tar.gz |
conf: storage: remove redundant condition
We exit early if poolOptions->formatToString is false.
Fixes: 9dadc7302920f9fca0057c655d03c2b0206b9a70
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
-rw-r--r-- | src/conf/storage_conf.c | 22 |
1 files 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; if (!(poolOptions = virStoragePoolOptionsForPoolType(type))) return -1; @@ -374,22 +375,17 @@ virStoragePoolOptionsFormatPool(virBuffer *buf, virBufferAddLit(buf, "<poolOptions>\n"); virBufferAdjustIndent(buf, 2); - if (poolOptions->formatToString) { - size_t i; - - virBufferAsprintf(buf, "<defaultFormat type='%s'/>\n", - (poolOptions->formatToString)(poolOptions->defaultFormat)); + virBufferAsprintf(buf, "<defaultFormat type='%s'/>\n", + (poolOptions->formatToString)(poolOptions->defaultFormat)); - virBufferAddLit(buf, "<enum name='sourceFormatType'>\n"); - virBufferAdjustIndent(buf, 2); + virBufferAddLit(buf, "<enum name='sourceFormatType'>\n"); + virBufferAdjustIndent(buf, 2); - for (i = 0; i < poolOptions->lastFormat; i++) - virBufferAsprintf(buf, "<value>%s</value>\n", - (poolOptions->formatToString)(i)); + for (i = 0; i < poolOptions->lastFormat; i++) + virBufferAsprintf(buf, "<value>%s</value>\n", (poolOptions->formatToString)(i)); - virBufferAdjustIndent(buf, -2); - virBufferAddLit(buf, "</enum>\n"); - } + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "</enum>\n"); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "</poolOptions>\n"); |