From 154ea505e7407b060587c66aead8310a0b08ef7f Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Wed, 24 Apr 2013 19:05:27 +0300 Subject: [PATCH] objects: limit development-related error message to debug builds --- 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 ad65a97260..e276d840fb 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); -- 2.39.2