[vlc-devel] commit: variables: add a warning when adding a callback to a non existant variable. ( Rémi Duraffort )

git version control git at videolan.org
Mon Sep 14 22:46:56 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Mon Sep 14 19:40:27 2009 +0200| [18555a9ecbf4ef622a69824fea76c6e564780047] | committer: Rémi Duraffort 

variables: add a warning when adding a callback to a non existant variable.

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

 src/misc/variables.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/misc/variables.c b/src/misc/variables.c
index 1134326..8c4122d 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -621,11 +621,8 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name,
                 p_var->psz_text = NULL;
             break;
         case VLC_VAR_GETTEXT:
-            p_val->psz_string = NULL;
-            if( p_var->psz_text )
-            {
-                p_val->psz_string = strdup( p_var->psz_text );
-            }
+            p_val->psz_string = p_var->psz_text ? strdup( p_var->psz_text )
+                                                : NULL;
             break;
         case VLC_VAR_INHERITVALUE:
             {
@@ -915,6 +912,10 @@ int __var_AddCallback( vlc_object_t *p_this, const char *psz_name,
     i_var = GetUnused( p_this, psz_name );
     if( i_var < 0 )
     {
+#ifndef NDEBUG
+        msg_Warn( p_this, "Failed to add a callback to the non-existing "
+                          "variable '%s'", psz_name );
+#endif
         vlc_mutex_unlock( &p_priv->var_lock );
         return i_var;
     }




More information about the vlc-devel mailing list