[vlc-devel] [PATCH 1/2] notify: fix invalid function pointer cast

Rémi Denis-Courmont remi at remlab.net
Sun Sep 1 19:31:51 CEST 2019


Le samedi 31 août 2019, 11:16:35 EEST Alexandre Janniaux a écrit :
> `g_list_foreach` takes a void `(*GFunc)(void*, void*)` and `g_free`
> is a `void (void *)` function.

Obviously ok.

> ---
>  modules/notify/notify.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/modules/notify/notify.c b/modules/notify/notify.c
> index 9d3e809ab3..1bab4350af 100644
> --- a/modules/notify/notify.c
> +++ b/modules/notify/notify.c
> @@ -85,6 +85,12 @@ struct intf_sys_t
>      struct vlc_player_listener_id *player_listener;
>  };
> 
> +static void foreach_g_free(void *data, void *userdata)
> +{
> +    g_free(data);
> +    VLC_UNUSED(userdata);
> +}
> +
>  /**************************************************************************
> *** * Open: initialize and create stuff
>  
> ***************************************************************************
> **/ @@ -137,7 +143,7 @@ static int Open( vlc_object_t *p_this )
>                  break;
>              }
>          }
> -        g_list_foreach( p_caps, (GFunc)g_free, NULL );
> +        g_list_foreach( p_caps, foreach_g_free, NULL );
>          g_list_free( p_caps );
>      }
> 
> @@ -357,4 +363,3 @@ static int Notify( vlc_object_t *p_this, const char
> *psz_temp, GdkPixbuf *pix, p_sys->notification = notification;
>      return VLC_SUCCESS;
>  }
> -
> --
> 2.20.1
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


-- 
Rémi Denis-Courmont




More information about the vlc-devel mailing list