Re: [PATCH 3/8] domain_event: Add virDomainEventState structure

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

 



On 01/10/2011 10:38 AM, Cole Robinson wrote:
> This structure will be used to unify lots of duplicated event handling code
> across the state drivers.
> 
> Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
> ---
>  src/conf/domain_event.c |   91 ++++++++++++++++++++++++++++++++++++----------
>  src/conf/domain_event.h |   47 +++++++++++++++++-------
>  2 files changed, 104 insertions(+), 34 deletions(-)

Missing a tweak to the list of free-like functions in cfg.mk for
virDomainEventStateFree.

> +void
> +virDomainEventStateFree(virDomainEventStatePtr state)
> +{
> +    virDomainEventCallbackListFree(state->callbacks);

Missing an early exit for state==NULL, which is essential since
virDomainEventStateNew's error: block can hit that scenario.

> +
> +struct _virDomainEventState {
> +    /* The list of domain event callbacks */
> +    virDomainEventCallbackListPtr callbacks;
> +    /* The queue of domain events */
> +    virDomainEventQueuePtr queue;
> +    /* Timer for flushing events queue */
> +    int timer;
> +    /* Flag if we're in process of dispatching */
> +    int isDispatching;

s/int/bool/

> @@ -163,6 +177,11 @@ virDomainEventQueuePop(virDomainEventQueuePtr evtQueue);
>  
>  void virDomainEventFree(virDomainEventPtr event);
>  void virDomainEventQueueFree(virDomainEventQueuePtr queue);
> +void virDomainEventStateFree(virDomainEventStatePtr state);
> +virDomainEventStatePtr
> +virDomainEventStateNew(virEventTimeoutCallback timeout_cb,
> +                       void *timeout_opaque,
> +                       virFreeCallback timeout_free);

ATTRIBUTE_NONNULL(1) (the other two can reasonably be NULL, though).
[Hmm, we probably are missing some other useful ATTRIBUTE_NONNULL
markups throughout the event-related headers]

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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