[vlc-commits] objects: limit development-related error message to debug builds
Rémi Denis-Courmont
git at videolan.org
Wed Apr 24 18:08:56 CEST 2013
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Apr 24 19:05:27 2013 +0300| [154ea505e7407b060587c66aead8310a0b08ef7f] | committer: Rémi Denis-Courmont
objects: limit development-related error message to debug builds
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=154ea505e7407b060587c66aead8310a0b08ef7f
---
src/misc/objects.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/misc/objects.c b/src/misc/objects.c
index ad65a97..e276d84 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -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);
More information about the vlc-commits
mailing list