mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
util: Introduce function for allocating virStorageSource
Add virStorageSourceNew and refactor places allocating that structure to use the helper. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
@@ -55,7 +55,7 @@ testBackingXMLjsonXML(const void *args)
|
||||
VIR_AUTOPTR(virStorageSource) xmlsrc = NULL;
|
||||
VIR_AUTOPTR(virStorageSource) jsonsrc = NULL;
|
||||
|
||||
if (VIR_ALLOC(xmlsrc) < 0)
|
||||
if (!(xmlsrc = virStorageSourceNew()))
|
||||
return -1;
|
||||
|
||||
xmlsrc->type = data->type;
|
||||
|
||||
@@ -98,7 +98,7 @@ testStorageFileGetMetadata(const char *path,
|
||||
virStorageSourcePtr ret = NULL;
|
||||
VIR_AUTOPTR(virStorageSource) def = NULL;
|
||||
|
||||
if (VIR_ALLOC(def) < 0)
|
||||
if (!(def = virStorageSourceNew()))
|
||||
return NULL;
|
||||
|
||||
def->type = VIR_STORAGE_TYPE_FILE;
|
||||
|
||||
Reference in New Issue
Block a user