It allocates and initializes a virDomainDeviceInfo struct
in one fell swoop.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/conf/device_conf.c | 13 +++++++++++++
src/conf/device_conf.h | 1 +
2 files changed, 14 insertions(+)
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index 4644580..6ead830 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -32,6 +32,19 @@
#define VIR_FROM_THIS VIR_FROM_DEVICE
+virDomainDeviceInfoPtr
+virDomainDeviceInfoNew(void)
+{
+ virDomainDeviceInfoPtr info;
+
+ if (VIR_ALLOC(info) < 0)
+ return NULL;
+
+ virDomainDeviceInfoClear(info);
+
+ return info;
+}
+
void
virDomainDeviceInfoClear(virDomainDeviceInfoPtr info)
{
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index 53abe1b..8f641bc 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -170,6 +170,7 @@ struct _virDomainDeviceInfo {
char *loadparm;
};
+virDomainDeviceInfoPtr virDomainDeviceInfoNew(void);
void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info);
int virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst,
virDomainDeviceInfoPtr src);
--
2.7.5