conf: Avoid temporary variable in virDomainDiskBackingStoreFormat
Modify the check that the format is in range to be standalone and use the convertor function directly. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
eaef9b1f67
commit
945eab4060
@ -23826,7 +23826,6 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf,
|
|||||||
virDomainXMLOptionPtr xmlopt,
|
virDomainXMLOptionPtr xmlopt,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
const char *format;
|
|
||||||
bool inactive = flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE;
|
bool inactive = flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE;
|
||||||
|
|
||||||
if (!backingStore)
|
if (!backingStore)
|
||||||
@ -23841,8 +23840,7 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (backingStore->format <= 0 ||
|
if (backingStore->format <= 0 || backingStore->format >= VIR_STORAGE_FILE_LAST) {
|
||||||
!(format = virStorageFileFormatTypeToString(backingStore->format))) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unexpected disk backing store format %d"),
|
_("unexpected disk backing store format %d"),
|
||||||
backingStore->format);
|
backingStore->format);
|
||||||
@ -23856,7 +23854,8 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf,
|
|||||||
virBufferAddLit(buf, ">\n");
|
virBufferAddLit(buf, ">\n");
|
||||||
virBufferAdjustIndent(buf, 2);
|
virBufferAdjustIndent(buf, 2);
|
||||||
|
|
||||||
virBufferAsprintf(buf, "<format type='%s'/>\n", format);
|
virBufferAsprintf(buf, "<format type='%s'/>\n",
|
||||||
|
virStorageFileFormatTypeToString(backingStore->format));
|
||||||
if (virDomainDiskSourceFormat(buf, backingStore, 0, false, flags, xmlopt) < 0 ||
|
if (virDomainDiskSourceFormat(buf, backingStore, 0, false, flags, xmlopt) < 0 ||
|
||||||
virDomainDiskBackingStoreFormat(buf, backingStore->backingStore,
|
virDomainDiskBackingStoreFormat(buf, backingStore->backingStore,
|
||||||
xmlopt, flags) < 0)
|
xmlopt, flags) < 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user