[Spice-devel] [PATCH vd_agent_linux 1/3] x11-randr: Avoid passing XEvent as value

Frediano Ziglio fziglio at redhat.com
Wed Jul 24 08:13:56 UTC 2019


ping the series

> 
> The structure is not that small and is not necessary to copy
> the value.
> This also removed a Coverity warning.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  src/vdagent/x11-priv.h  | 2 +-
>  src/vdagent/x11-randr.c | 8 ++++----
>  src/vdagent/x11.c       | 2 +-
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/vdagent/x11-priv.h b/src/vdagent/x11-priv.h
> index 99676d2..730b9b3 100644
> --- a/src/vdagent/x11-priv.h
> +++ b/src/vdagent/x11-priv.h
> @@ -152,7 +152,7 @@ void vdagent_x11_send_daemon_guest_xorg_res(struct
> vdagent_x11 *x11,
>  void vdagent_x11_randr_handle_root_size_change(struct vdagent_x11 *x11,
>                                              int screen, int width, int
>                                              height);
>  int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11,
> -    XEvent event);
> +    const XEvent *event);
>  void vdagent_x11_set_error_handler(struct vdagent_x11 *x11,
>      int (*handler)(Display *, XErrorEvent *));
>  int vdagent_x11_restore_error_handler(struct vdagent_x11 *x11);
> diff --git a/src/vdagent/x11-randr.c b/src/vdagent/x11-randr.c
> index 88857c8..e299970 100644
> --- a/src/vdagent/x11-randr.c
> +++ b/src/vdagent/x11-randr.c
> @@ -529,14 +529,14 @@ void vdagent_x11_randr_handle_root_size_change(struct
> vdagent_x11 *x11,
>  }
>  
>  int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11,
> -    XEvent event)
> +    const XEvent *event)
>  {
>      int handled = TRUE;
>  
> -    switch (event.type - x11->xrandr_event_base) {
> +    switch (event->type - x11->xrandr_event_base) {
>          case RRScreenChangeNotify: {
> -            XRRScreenChangeNotifyEvent *sce =
> -                (XRRScreenChangeNotifyEvent *) &event;
> +            const XRRScreenChangeNotifyEvent *sce =
> +                (const XRRScreenChangeNotifyEvent *) event;
>              vdagent_x11_randr_handle_root_size_change(x11, 0,
>                  sce->width, sce->height);
>              break;
> diff --git a/src/vdagent/x11.c b/src/vdagent/x11.c
> index c2515a8..61d7c69 100644
> --- a/src/vdagent/x11.c
> +++ b/src/vdagent/x11.c
> @@ -545,7 +545,7 @@ static void vdagent_x11_handle_event(struct vdagent_x11
> *x11, XEvent event)
>      }
>  #endif
>  
> -    if (vdagent_x11_randr_handle_event(x11, event))
> +    if (vdagent_x11_randr_handle_event(x11, &event))
>          return;
>  
>      switch (event.type) {


More information about the Spice-devel mailing list