[Spice-devel] [linux/vd-agent v1 5/7] coverity: allow pass by value with XEvent

Frediano Ziglio fziglio at redhat.com
Mon Jul 15 09:16:03 UTC 2019


> Subject: [Spice-devel] [linux/vd-agent v1 5/7] coverity: allow pass by value with XEvent

I would say that this patch is ignoring a warning, the code is compiling.

> 
> From: Victor Toso <me at victortoso.com>
> 
> Signed-off-by: Victor Toso <victortoso at redhat.com>
> ---
>  src/vdagent/x11-randr.c | 4 ++--
>  src/vdagent/x11.c       | 1 +
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/vdagent/x11-randr.c b/src/vdagent/x11-randr.c
> index d000e28..924f5ec 100644
> --- a/src/vdagent/x11-randr.c
> +++ b/src/vdagent/x11-randr.c
> @@ -528,8 +528,8 @@ void vdagent_x11_randr_handle_root_size_change(struct
> vdagent_x11 *x11,
>      }
>  }
>  
> -int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11,
> -    XEvent event)
> +/* coverity[pass_by_value] */
> +int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11, XEvent event)
>  {
>      int handled = TRUE;
>  
> diff --git a/src/vdagent/x11.c b/src/vdagent/x11.c
> index c2515a8..90d08a1 100644
> --- a/src/vdagent/x11.c
> +++ b/src/vdagent/x11.c
> @@ -494,6 +494,7 @@ static int vdagent_x11_get_clipboard_selection(struct
> vdagent_x11 *x11,
>  }
>  #endif
>  
> +/* coverity[pass_by_value] */
>  static void vdagent_x11_handle_event(struct vdagent_x11 *x11, XEvent event)
>  {
>      int i, handled = 0;

Have you though about converting to "const XEvent*" ?
The structure is not that small.

Frediano


More information about the Spice-devel mailing list