[vlc-devel] [PATCH 5/5] variables: warn when a variable is created twice in the same object

Alexandre Janniaux ajanni at videolabs.io
Fri Mar 13 15:33:01 CET 2020


Hi,

On Fri, Mar 13, 2020 at 03:00:32PM +0100, Steve Lhomme wrote:
> Only in debug builds.
>
> Currently the command line options are created twice in libvlc.
> ---
>  src/misc/variables.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/src/misc/variables.c b/src/misc/variables.c
> index ed284cf4f4c..acabc0ea59c 100644
> --- a/src/misc/variables.c
> +++ b/src/misc/variables.c
> @@ -350,6 +350,16 @@ int (var_Create)( vlc_object_t *p_this, const char *psz_name, int i_type )
>
>      if (i_type & VLC_VAR_DOINHERIT)
>          var_Inherit(p_this, psz_name, i_type, &p_var->val);
> +#ifndef _NDEBUG

This should probably be NDEBUG according to git grep.

I'm not sure why you would do this only in debug, or even
here, you want to remove duplicate var_Create?

> +    else
> +    {
> +        vlc_value_t val;
> +        if (var_GetChecked( p_this, psz_name, i_type & VLC_VAR_CLASS, &val ) ==
> +            VLC_SUCCESS)
> +            msg_Warn( p_this, "variable '%s' already created in '%s'",
> +                      psz_name, vlc_object_typename(p_this) );
> +    }
> +#endif
>
>      vlc_object_internals_t *p_priv = vlc_internals( p_this );
>      void **pp_var;
> --
> 2.17.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list