Re: [PATCH 09/34] Create virDomainEventLifecycle to start removing the huge union

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

 



On Fri, Nov 29, 2013 at 04:18:45PM +0100, Cédric Bosdonnat wrote:
> ---
>  src/conf/domain_event.c | 65 ++++++++++++++++++++++++++++++++++---------------
>  src/conf/domain_event.h |  8 +++---
>  2 files changed, 50 insertions(+), 23 deletions(-)
> 
> diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
> index ff4f69a..a69ce11 100644
> --- a/src/conf/domain_event.c
> +++ b/src/conf/domain_event.c
> @@ -76,10 +76,14 @@ struct _virObjectEventCallback {
>      int deleted;
>  };
>  
> +
> +

Nit-pick: add these 2 lines in the previous patch when you rebase next

>  static virClassPtr virObjectEventClass;
>  static virClassPtr virDomainEventClass;
> +static virClassPtr virDomainEventLifecycleClass;
>  static void virObjectEventDispose(void *obj);
>  static void virDomainEventDispose(void *obj);
> +static void virDomainEventLifecycleDispose(void *obj);
>  
>  struct _virObjectEvent {
>      virObject parent;

> @@ -764,37 +786,37 @@ static void *virDomainEventNewInternal(virClassPtr klass,
>      return event;
>  }
>  
> -virDomainEventPtr virDomainEventNew(int id, const char *name,
> +void *virDomainEventNew(int id, const char *name,
>                                      const unsigned char *uuid,
>                                      int type, int detail)
>  {
> -    virDomainEventPtr event;
> +    virDomainEventLifecyclePtr event;
>  
>      if (virObjectEventInitialize() < 0)
>          return NULL;
>  
> -    if (!(event = virDomainEventNewInternal(virDomainEventClass,
> -                                      VIR_DOMAIN_EVENT_ID_LIFECYCLE,
> -                                      id, name, uuid)))
> +    if (!(event = virDomainEventNewInternal(virDomainEventLifecycleClass,
> +                                            VIR_DOMAIN_EVENT_ID_LIFECYCLE,
> +                                            id, name, uuid)))
>          return NULL;
>  
> -    event->data.lifecycle.type = type;
> -    event->data.lifecycle.detail = detail;
> +    event->type = type;
> +    event->detail = detail;
>  
>      return event;
>  }
>  
> -virDomainEventPtr virDomainEventNewFromDom(virDomainPtr dom, int type, int detail)
> +void *virDomainEventNewFromDom(virDomainPtr dom, int type, int detail)
>  {
>      return virDomainEventNew(dom->id, dom->name, dom->uuid, type, detail);
>  }
>  
> -virDomainEventPtr virDomainEventNewFromObj(virDomainObjPtr obj, int type, int detail)
> +void *virDomainEventNewFromObj(virDomainObjPtr obj, int type, int detail)
>  {
>      return virDomainEventNewFromDef(obj->def, type, detail);
>  }
>  
> -virDomainEventPtr virDomainEventNewFromDef(virDomainDefPtr def, int type, int detail)
> +void *virDomainEventNewFromDef(virDomainDefPtr def, int type, int detail)

I think I'd prefer these to return 'virObjectEventPtr' rather than void *, 
since that's the shared base class of all these event types

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[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]