[vlc-devel] [PATCH] extractor: avoid one strcmp()

Filip Roséen filip at atch.se
Sat Feb 25 09:13:50 CET 2017


Hi Rémi,

On 2017-02-25 09:48, Rémi Denis-Courmont wrote:

> ---
>  src/input/stream_extractor.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/input/stream_extractor.c b/src/input/stream_extractor.c
> index 68d76f13c3..00cf5ee624 100644
> --- a/src/input/stream_extractor.c
> +++ b/src/input/stream_extractor.c
> @@ -281,8 +281,9 @@ static int
>  StreamExtractorAttach( stream_t** source, char const* identifier,
>      char const* module_name )
>  {
> -    char const* capability = identifier ? "stream_extractor"
> -                                        : "stream_directory";
> +    const bool extractor = identifier != NULL;
> +    char const* capability = extractor ? "stream_extractor"
> +                                       : "stream_directory";
>  
>      struct stream_extractor_private* priv = vlc_custom_create(
>          (*source)->obj.parent, sizeof( *priv ), capability );
> @@ -290,7 +291,7 @@ StreamExtractorAttach( stream_t** source, char const* identifier,
>      if( unlikely( !priv ) )
>          return VLC_ENOMEM;
>  
> -    if( strcmp( capability, "stream_extractor" ) == 0 )
> +    if( extractor )
>      {
>          priv->object = VLC_OBJECT( &priv->extractor );
>  

I have no strong opinion about this, I obviously decided not to write
it like that but with that in mind; LGTM.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170225/52df55d3/attachment-0001.html>


More information about the vlc-devel mailing list