[vlc-devel] commit: variables: print a warning if the callback isn' t found or if a close callback ( Rémi Duraffort )

git version control git at videolan.org
Sun Aug 30 14:51:25 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sun Aug 30 13:11:17 2009 +0200| [a02413ba579ecc8501c5a65c9c315b7c0a64ff5a] | committer: Rémi Duraffort 

variables: print a warning if the callback isn't found or if a close callback
is found (same function but not same data).
This can be usefull to find some errors.
This is only activated in debug mode.

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

 src/misc/variables.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/misc/variables.c b/src/misc/variables.c
index 737956f..b5ac4bf 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -919,6 +919,9 @@ int __var_DelCallback( vlc_object_t *p_this, const char *psz_name,
 {
     int i_entry, i_var;
     variable_t *p_var;
+#ifndef NDEBUG
+    bool b_found_similar = false;
+#endif
     vlc_object_internals_t *p_priv = vlc_internals( p_this );
 
     vlc_mutex_lock( &p_priv->var_lock );
@@ -941,15 +944,20 @@ int __var_DelCallback( vlc_object_t *p_this, const char *psz_name,
         }
 #ifndef NDEBUG
         else if( p_var->p_entries[i_entry].pf_callback == pf_callback )
-        {
-            msg_Warn( p_this, "Calling var_DelCallback for '%s' with the same "
-                      "function but not the same data.", psz_name );
-        }
+            b_found_similar = true;
 #endif
     }
 
     if( i_entry < 0 )
     {
+#ifndef NDEBUG
+        if( b_found_similar )
+            msg_Warn( p_this, "Calling var_DelCallback for '%s' with the same "
+                              "function but not the same data.", psz_name );
+        else
+            msg_Warn( p_this, "var_DelCallback can't find the callback for "
+                              "'%s'", psz_name );
+#endif
         vlc_mutex_unlock( &p_priv->var_lock );
         return VLC_EGENERIC;
     }




More information about the vlc-devel mailing list