mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
snapshot: Add virDomainSnapshotDefNew
In preparation for making virDomainSnapshotDef a descendant of virObject, it is time to fix all callers that allocate an object to use virDomainSnapshotDefNew() instead of VIR_ALLOC(). Fortunately, there aren't very many :) Signed-off-by: Eric Blake <eblake@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
098043eddd
commit
7fe07761a7
@ -81,6 +81,15 @@ virDomainSnapshotDiskDefClear(virDomainSnapshotDiskDefPtr disk)
|
||||
disk->src = NULL;
|
||||
}
|
||||
|
||||
virDomainSnapshotDefPtr
|
||||
virDomainSnapshotDefNew(void)
|
||||
{
|
||||
virDomainSnapshotDefPtr def;
|
||||
|
||||
ignore_value(VIR_ALLOC(def));
|
||||
return def;
|
||||
}
|
||||
|
||||
void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def)
|
||||
{
|
||||
size_t i;
|
||||
@ -205,8 +214,8 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt,
|
||||
bool offline = !!(flags & VIR_DOMAIN_SNAPSHOT_PARSE_OFFLINE);
|
||||
virSaveCookieCallbacksPtr saveCookie = virDomainXMLOptionGetSaveCookie(xmlopt);
|
||||
|
||||
if (VIR_ALLOC(def) < 0)
|
||||
goto cleanup;
|
||||
if (!(def = virDomainSnapshotDefNew()))
|
||||
return NULL;
|
||||
|
||||
def->parent.name = virXPathString("string(./name)", ctxt);
|
||||
if (def->parent.name == NULL) {
|
||||
|
@ -114,6 +114,7 @@ virDomainSnapshotDefPtr virDomainSnapshotDefParseNode(xmlDocPtr xml,
|
||||
virDomainXMLOptionPtr xmlopt,
|
||||
bool *current,
|
||||
unsigned int flags);
|
||||
virDomainSnapshotDefPtr virDomainSnapshotDefNew(void);
|
||||
void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def);
|
||||
char *virDomainSnapshotDefFormat(const char *uuidstr,
|
||||
virDomainSnapshotDefPtr def,
|
||||
|
@ -894,6 +894,7 @@ virDomainSnapshotAlignDisks;
|
||||
virDomainSnapshotDefFormat;
|
||||
virDomainSnapshotDefFree;
|
||||
virDomainSnapshotDefIsExternal;
|
||||
virDomainSnapshotDefNew;
|
||||
virDomainSnapshotDefParseString;
|
||||
virDomainSnapshotFormatConvertXMLFlags;
|
||||
virDomainSnapshotIsExternal;
|
||||
|
@ -6220,7 +6220,8 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
|
||||
if (!(snap = vboxDomainSnapshotGet(data, dom, machine, snapshot->name)))
|
||||
goto cleanup;
|
||||
|
||||
if (VIR_ALLOC(def) < 0 || !(def->parent.dom = virDomainDefNew()))
|
||||
if (!(def = virDomainSnapshotDefNew()) ||
|
||||
!(def->parent.dom = virDomainDefNew()))
|
||||
goto cleanup;
|
||||
defdom = def->parent.dom;
|
||||
if (VIR_STRDUP(def->parent.name, snapshot->name) < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user