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

RĂ©mi Denis-Courmont remi at remlab.net
Sat Feb 25 08:48:31 CET 2017


---
 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 );
 
-- 
2.11.0



More information about the vlc-devel mailing list