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 01:33:42PM +0100, Peter Krempa wrote:
> On Tue, Mar 10, 2020 at 17:30:01 +0530, 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(-)
> > 
> > diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> > index 3d3f796d85..0d2edf4dbe 100644
> > --- a/src/qemu/qemu_domain.c
> > +++ b/src/qemu/qemu_domain.c
> > @@ -150,7 +150,7 @@ qemuDomainObjFromDomain(virDomainPtr domain)
> 
> [...]
> 
> >  static int
> >  qemuDomainOnceInit(void)
> >  {
> > -    if (!VIR_CLASS_NEW(qemuDomainLogContext, virClassForObject()))
> > -        return -1;
> > -
> >      if (!VIR_CLASS_NEW(qemuDomainSaveCookie, virClassForObject()))
> >          return -1;
> >  
> >      return 0;
> >  }
> >  
> > +static void qemu_domain_log_context_init(qemuDomainLogContext *logctxt G_GNUC_UNUSED)
> > +{
> > +}
> 
> There's no reason to break coding style rules in this kind of refactor
> nor to make it inconsistent in span of 20 lines.

If you're refering to the use of underscores, then this is expected
and indeed required because these method names are auto-generated
by the GObject macros. This should only be the case for three
specific methods (_init, _class_init and _get_type), with the rest
all following normal style. See the virIdentity conversion for
the prior example of this.

> 
> > +
> > +static void qemu_domain_log_context_class_init(qemuDomainLogContextClass *klass)
> > +{
> > +    GObjectClass *obj = G_OBJECT_CLASS(klass);
> > +
> > +    obj->finalize = qemuDomainLogContextFinalize;
> > +}
> > +
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|





[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