[vlc-devel] [PATCH 5/7] config/chain: only create variable if it does not exists

Filip Roséen filip at atch.se
Wed Oct 12 21:37:23 CEST 2016


Hi Rémi,

Just earlier today I discussed the patch in question with *tguillem*,
and at first I decided "nhaa, let's forget about it - it's not too
important" but for some reason my mind went back to "aw what the heck,
let's include it" when I issued `git format-patch`.

On 2016-10-12 22:30, Rémi Denis-Courmont wrote:

> 	Hello,

The more I think about it, the less I am able to come up with a
rationale that holds water for the patch in question.

I decided to include it based on the fact that var_Create can be
somewhat expensive (and disregarding it if the variable exists could
save a few cycles), but that is a micro optimization at best, and I
have not even benchmarked it (painfully honest).

> I don't think that's correct, insofar as the existing lifecycle model for 
> variables is retained. I also don't really see the point.

The patch can be safely dropped as it is not important to the real
cause for the patch-set.

Thank you for your input!

> 
> Le mercredi 12 octobre 2016, 19:39:37 Filip Roséen a écrit :
> > ---
> >  src/config/chain.c | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> > 
> > diff --git a/src/config/chain.c b/src/config/chain.c
> > index 7d0b71d..e20585d 100644
> > --- a/src/config/chain.c
> > +++ b/src/config/chain.c
> > @@ -281,9 +281,13 @@ void config_ChainParse( vlc_object_t *p_this, const
> > char *psz_prefix,
> > 
> >          char name[plen + strlen( optname )];
> >          snprintf( name, sizeof (name), "%s%s", psz_prefix, optname );
> > -        if( var_Create( p_this, name,
> > -                        config_GetType( p_this, name ) | VLC_VAR_DOINHERIT
> > ) ) -            return /* VLC_xxx */;
> > +
> > +        if( var_Type( p_this, name ) == 0 )
> > +        {
> > +            if( var_Create( p_this, name, config_GetType( p_this, name ) |
> > +                                          VLC_VAR_DOINHERIT ) )
> > +                return /* VLC_xxx */;
> > +        }
> >      }
> > 
> >      /* Now parse options and set value */
> 
> -- 
> Rémi Denis-Courmont
> http://www.remlab.net/
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20161012/d6d86289/attachment.html>


More information about the vlc-devel mailing list