[RFC] qemu: convert DomainLogContext class to use GObject

Ján Tomko jtomko at redhat.com
Tue Mar 10 17:20:49 UTC 2020


On a Tuesday in 2020, Gaurav Agrawal wrote:
>---
> src/qemu/qemu_domain.c  | 36 ++++++++++++++++++++----------------
> src/qemu/qemu_domain.h  |  6 ++++--
> src/qemu/qemu_process.c |  4 ++--
> 3 files changed, 26 insertions(+), 20 deletions(-)
>

[...]

>@@ -10632,7 +10635,8 @@ qemuDomainLogContextPtr qemuDomainLogContextNew(virQEMUDriverPtr driver,
>     return ctxt;
>
>  error:
>-    virObjectUnref(ctxt);
>+    if (ctxt)
>+        g_object_unref(ctxt);

g_object_unref is safe to call with a NULL argument, the "if (ctxt)"
check is not needed here.

>     return NULL;
> }
>
>diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
>index 3929ee9ca1..3c270b87a2 100644
>--- a/src/qemu/qemu_domain.h
>+++ b/src/qemu/qemu_domain.h
>@@ -37,6 +37,8 @@
> #include "virmdev.h"
> #include "virchrdev.h"
> #include "virobject.h"

>+#include "internal.h"

The "internal.h" addition is not necessary for this patch - all the
types are in glib-object.

In the virIdentity conversion, other parts of the include file relied
on "internal.h" being included indirectly through "virobject.h".


>+#include <glib-object.h>

Please put the includes in angle brackets at the beginning of the file:
https://libvirt.org/hacking.html#includes

Otherwise the patch looks good to me.

Jano

> #include "logging/log_manager.h"
> #include "virdomainmomentobjlist.h"
> #include "virenum.h"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200310/bd8ba064/attachment-0001.sig>


More information about the libvir-list mailing list