[vlc-commits] objects: remove zvbi from find_name

Rémi Denis-Courmont git at videolan.org
Sun Mar 3 16:52:19 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Mar  3 13:36:30 2019 +0200| [a076bbe1ece17367a1e3f3e1ecc40a50dcd490ee] | committer: Rémi Denis-Courmont

objects: remove zvbi from find_name

As of now, only "v4l2" is ever still used.

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

 src/misc/objects.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/src/misc/objects.c b/src/misc/objects.c
index a679a7e9fd..3481acbb22 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -290,9 +290,13 @@ static vlc_mutex_t name_lock = VLC_STATIC_MUTEX;
 int vlc_object_set_name(vlc_object_t *obj, const char *name)
 {
     vlc_object_internals_t *priv = vlc_internals(obj);
-    char *newname = name ? strdup (name) : NULL;
+    char *newname = NULL;
     char *oldname;
 
+    /* See vlc_object_find_name(). */
+    if (unlikely(strcmp(name, "v4l2") == 0))
+        newname = strdup(name);
+
     vlc_mutex_lock (&name_lock);
     oldname = priv->psz_name;
     priv->psz_name = newname;
@@ -364,11 +368,6 @@ static vlc_object_t *FindName (vlc_object_t *obj, const char *name)
     return found;
 }
 
-static int strcmp_void(const void *a, const void *b)
-{
-    return strcmp(a, b);
-}
-
 #undef vlc_object_find_name
 /**
  * Finds a named object and increment its reference count.
@@ -393,15 +392,10 @@ vlc_object_t *vlc_object_find_name( vlc_object_t *p_this, const char *psz_name )
      * deal with asynchronous and external state changes. There may be multiple
      * objects with the same name, and the function may fail even if a matching
      * object exists. DO NOT USE THIS IN NEW CODE. */
-#ifndef NDEBUG
-    /* This was officially deprecated on August 19 2009. For the convenience of
-     * wannabe code janitors, this is the list of names that remain used
-     * and unfixed since then. */
-    static const char bad[][5] = { "v4l2", "zvbi" };
-    if( bsearch( psz_name, bad, 2, 5, strcmp_void ) == NULL )
+    /* This was officially deprecated on August 19 2009. As of 2019, only
+     * the V4L2 input controls still rely on this. */
+    if (strcmp(psz_name, "v4l2"))
         return NULL;
-    msg_Err( p_this, "looking for object \"%s\"... FIXME XXX", psz_name );
-#endif
 
     vlc_mutex_lock (&name_lock);
     vlc_mutex_lock(&tree_lock);



More information about the vlc-commits mailing list