On Wed, May 08, 2019 at 17:24:11 -0500, Eric Blake wrote:
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(a)redhat.com>
---
src/conf/snapshot_conf.h | 1 +
src/conf/snapshot_conf.c | 16 +++++++++++++---
src/libvirt_private.syms | 1 +
src/vbox/vbox_common.c | 3 ++-
4 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h
index f54be11619..0ce9dda355 100644
--- a/src/conf/snapshot_conf.h
+++ b/src/conf/snapshot_conf.h
@@ -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,
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index dd281d57fe..e5771ae635 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -81,7 +81,17 @@ virDomainSnapshotDiskDefClear(virDomainSnapshotDiskDefPtr disk)
disk->src = NULL;
}
-void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def)
+virDomainSnapshotDefPtr
+virDomainSnapshotDefNew(void)
+{
+ virDomainSnapshotDefPtr def;
+
+ ignore_value(VIR_ALLOC(def));
+ return def;
+}
+
+void
+virDomainSnapshotDefFree(virDomainSnapshotDefPtr def)
This is changed/deleted again in next patch so this patch shouldn't
tweak the style.
ACK