[libvirt] [PATCH 3/4] snapshot: Add virDomainSnapshotDefNew

Peter Krempa pkrempa at redhat.com
Thu May 9 13:01:58 UTC 2019


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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190509/76bd3fbc/attachment-0001.sig>


More information about the libvir-list mailing list