[pacman-dev] [PATCH] events: Make alpm_event_t an union of all event-specific struct

Allan McRae allan at archlinux.org
Mon Jun 23 08:31:23 EDT 2014


On 16/06/14 03:43, Olivier Brunel wrote:
> Signed-off-by: Olivier Brunel <jjk at jjacky.com>
> ---
> Similar as changes done re: questions.

I like this better than the old approach.   One query...

> 
>  lib/libalpm/alpm.h    | 29 ++++++++++++++++++++++-------
>  src/pacman/callback.c | 25 ++++++++++++-------------
>  2 files changed, 34 insertions(+), 20 deletions(-)
> 
> diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
> index b0adb95..ffd71c6 100644
> --- a/lib/libalpm/alpm.h
> +++ b/lib/libalpm/alpm.h
> @@ -361,15 +361,10 @@ typedef enum _alpm_event_type_t {
>  	ALPM_EVENT_PACORIG_CREATED
>  } alpm_event_type_t;
>  
> -/** Events.
> - * This is a generic struct this is passed to the callback, that allows the
> - * frontend to know which type of event was triggered. It is then possible to
> - * typecast the pointer to the right structure, in order to access
> - * event-specific data. */
> -typedef struct _alpm_event_t {
> +typedef struct _alpm_event_any_t {
>  	/** Type of event. */
>  	alpm_event_type_t type;
> -} alpm_event_t;
> +} alpm_event_any_t;

Why is this kept?





More information about the pacman-dev mailing list