]> git.sesse.net Git - vlc/commitdiff
objects: limit development-related error message to debug builds
authorRémi Denis-Courmont <remi@remlab.net>
Wed, 24 Apr 2013 16:05:27 +0000 (19:05 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Wed, 24 Apr 2013 16:07:14 +0000 (19:07 +0300)
src/misc/objects.c

index ad65a97260a4f8055b56511804c9994896b8851e..e276d840fb0b585391b44a5a88cda5726e37e10c 100644 (file)
@@ -428,9 +428,25 @@ vlc_object_t *vlc_object_find_name( vlc_object_t *p_this, const char *psz_name )
 {
     vlc_object_t *p_found;
 
-    /* Reading psz_object_name from a separate inhibits thread-safety.
-     * Use a libvlc address variable instead for that sort of things! */
-    msg_Err( p_this, "%s(\"%s\") is not safe!", __func__, psz_name );
+    /* The object name is not thread-safe, provides no warranty that the
+     * object is fully initialized and still active, and that its owner can
+     * 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 const bad[][11] = { "adjust", "clone", "colorthres",
+        "erase", "extract", "gradient", "logo", "marq", "motionblur", "puzzle",
+        "rotate", "sharpen", "transform", "v4l2", "wall" };
+    static const char const poor[][13] = { "invert", "magnify", "motiondetect",
+        "psychedelic", "ripple", "wave" };
+    if( bsearch( psz_name, bad, 15, 11, (void *)strcmp ) == NULL
+     && bsearch( psz_name, poor, 6, 13, (void *)strcmp ) == NULL )
+        return NULL;
+    msg_Err( p_this, "looking for object \"%s\"... FIXME XXX", psz_name );
+#endif
 
     libvlc_lock (p_this->p_libvlc);
     vlc_mutex_lock (&name_lock);