[vlc-commits] input/demux: refactor and rename typecmp (to demux_mapping_cmp)

Filip Roséen git at videolan.org
Tue Aug 2 15:47:21 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Sat Jul 30 05:48:06 2016 +0200| [2cbd3f50c67a095d9548c6c5ae3ce1d9c3fccd82] | committer: Jean-Baptiste Kempf

input/demux: refactor and rename typecmp (to demux_mapping_cmp)

This commit renames "typecmp" to "demux_mapping_cmp" in order for it
to be more generic (and not cause confusion when it is used in other
scenarios than what it has been previously).

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

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

diff --git a/src/input/demux.c b/src/input/demux.c
index c8a6ca5..eb1eb86 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -45,12 +45,10 @@ typedef const struct
 
 } demux_mapping;
 
-static int typecmp( const void *k, const void *t )
+static int demux_mapping_cmp( const void *k, const void *v )
 {
-    const char *key = k;
-    demux_mapping *type = t;
-
-    return vlc_ascii_strcasecmp( key, type->key );
+    demux_mapping* entry = v;
+    return vlc_ascii_strcasecmp( k, entry->key );
 }
 
 static const char *demux_NameFromContentType(const char *mime)
@@ -68,8 +66,8 @@ static const char *demux_NameFromContentType(const char *mime)
         { "video/nsa",           "nsv"     },
         { "video/nsv",           "nsv"     },
     };
-    demux_mapping* type = bsearch( mime, types, ARRAY_SIZE( types ),
-                                   sizeof( types[0] ), typecmp );
+    demux_mapping *type = bsearch( mime, types, ARRAY_SIZE( types ),
+                                   sizeof( *type ), demux_mapping_cmp );
     return (type != NULL) ? type->name : "any";
 }
 



More information about the vlc-commits mailing list