On Fri, May 04, 2018 at 17:25:32 +0800, Lin Ma wrote:
> It will be used in next patch for event name completion.
> 
> Signed-off-by: Lin Ma <l...@suse.com>
> ---
>  src/conf/domain_event.c  | 62 
> ++++++++++++++++++++++++++++++++++++++++++++++++
>  src/conf/domain_event.h  |  3 +++
>  src/libvirt_private.syms |  1 +
>  3 files changed, 66 insertions(+)
> 
> diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
> index 97520706c9..f8bd457b34 100644
> --- a/src/conf/domain_event.c
> +++ b/src/conf/domain_event.c
> @@ -1968,6 +1968,68 @@ virDomainEventDispatchDefaultFunc(virConnectPtr conn,
>  }
>  
>  
> +const char *
> +virDomainEventGetName(int event)
> +{
> +    virResetLastError();

This should not be necessary. This function shall not touch the error
since it does not report any. The caller needs to handle it properly.

> +
> +    switch (event) {

Typecast event to the proper type so that compiler moans when new events
are added.

> +    case VIR_DOMAIN_EVENT_ID_LIFECYCLE:
> +        return VIR_DOMAIN_EVENT_LIFECYCLE;
> +    case VIR_DOMAIN_EVENT_ID_REBOOT:
> +        return VIR_DOMAIN_EVENT_REBOOT;

[...]

Attachment: signature.asc
Description: PGP signature

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

Reply via email to