On 12/10/21 21:34, Praveen K Paladugu wrote:
From: Vineeth Pillai <viremana(a)linux.microsoft.com>
Signed-off-by: Vineeth Pillai <viremana(a)linux.microsoft.com>
Signed-off-by: Praveen K Paladugu <prapal(a)linux.microsoft.com>
---
src/ch/ch_domain.c | 50 +++++++++++++++++++++++++++++++++++++++++-----
src/ch/ch_domain.h | 11 ++++++++++
2 files changed, 56 insertions(+), 5 deletions(-)
diff --git a/src/ch/ch_domain.c b/src/ch/ch_domain.c
index bf4ce83595..36333a8a3f 100644
--- a/src/ch/ch_domain.c
+++ b/src/ch/ch_domain.c
@@ -164,11 +164,6 @@ virCHDomainObjPrivateFree(void *data)
g_free(priv);
}
-virDomainXMLPrivateDataCallbacks virCHDriverPrivateDataCallbacks = {
- .alloc = virCHDomainObjPrivateAlloc,
- .free = virCHDomainObjPrivateFree,
-};
-
static int
virCHDomainDefPostParseBasic(virDomainDef *def,
void *opaque G_GNUC_UNUSED)
@@ -185,6 +180,45 @@ virCHDomainDefPostParseBasic(virDomainDef *def,
return 0;
}
+static virClass *virCHDomainVcpuPrivateClass;
+static void virCHDomainVcpuPrivateDispose(void *obj);
This forward declaration could be replaced with the actual implementation.
+
+static int
+virCHDomainVcpuPrivateOnceInit(void)
+{
+ if (!VIR_CLASS_NEW(virCHDomainVcpuPrivate, virClassForObject()))
+ return -1;
+
+ return 0;
+}
+
+VIR_ONCE_GLOBAL_INIT(virCHDomainVcpuPrivate);
+
+static virObject *
+virCHDomainVcpuPrivateNew(void)
+{
+ virCHDomainVcpuPrivate *priv;
+
+ if (virCHDomainVcpuPrivateInitialize() < 0)
+ return NULL;
+
+ if (!(priv = virObjectNew(virCHDomainVcpuPrivateClass)))
+ return NULL;
+
+ return (virObject *) priv;
+}
+
+
+static void
+virCHDomainVcpuPrivateDispose(void *obj)
+{
+ virCHDomainVcpuPrivate *priv = obj;
+
+ priv->tid = 0;
+
+ return;
This is basically a NOP. Nothing here deallocates any memory and
clearing our memory to zero is needless.
+}
Reviewed-by: Michal Privoznik <mprivozn(a)redhat.com>
Michal