Re: [RFC] qemu: convert DomainLogContext class to use GObject

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 10, 2020 at 17:30:28 +0000, Daniel Berrange wrote:
> On Tue, Mar 10, 2020 at 06:20:49PM +0100, Ján Tomko wrote:
> > 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.
> 
> I'm not so sure on that.
> 
> g_clear_object API docs explicitly say that it is OK if the object is NULL:
> 
>    https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#g-clear-object

I'd prefer we agree on using this one globally on the same basis we had
for using VIR_FREE even on cleanup paths.





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux