[vlc-commits] demux: avoid one string comparison

Rémi Denis-Courmont git at videolan.org
Sat Sep 26 21:23:37 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Sep 25 19:17:10 2020 +0300| [159be0ed8c21deca546c3208c97aa75dd71ec12b] | committer: Rémi Denis-Courmont

demux: avoid one string comparison

Track the correct strict flag value. (Note that the strict flag has no
effects if the requested module name is "any".)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=159be0ed8c21deca546c3208c97aa75dd71ec12b
---

 src/input/demux.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/input/demux.c b/src/input/demux.c
index 0ecf394667..6707b8cc73 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -154,6 +154,7 @@ demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_input,
     p_demux->p_sys      = NULL;
 
     char *modbuf = NULL;
+    bool strict = true;
 
     if (!strcasecmp(module, "any" ) || module[0] == '\0') {
         /* Look up demux by content type for hard to detect formats */
@@ -163,6 +164,7 @@ demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_input,
             module = demux_NameFromMimeType(type);
             free(type);
         }
+        strict = false;
     }
 
     if (strcasecmp(module, "any") == 0 && p_demux->psz_filepath != NULL)
@@ -176,10 +178,9 @@ demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_input,
             if (likely(asprintf(&modbuf, "ext-%s", ext + 1) >= 0))
                 module = modbuf;
         }
+        strict = false;
     }
 
-    bool strict = strcmp(module, p_demux->psz_name) == 0;
-
     priv->module = vlc_module_load(p_demux, "demux", module, strict,
                                    demux_Probe, p_demux);
     free(modbuf);



More information about the vlc-commits mailing list