[vlc-devel] [PATCH 5/5] variables: warn when a variable is created twice in the same object
    Steve Lhomme 
    robux4 at ycbcr.xyz
       
    Fri Mar 13 16:05:44 CET 2020
    
    
  
Only in debug builds.
Currently the command line options are created twice in libvlc.
---
 src/misc/variables.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/src/misc/variables.c b/src/misc/variables.c
index ed284cf4f4c..1c7d674b72d 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -350,6 +350,14 @@ int (var_Create)( vlc_object_t *p_this, const char *psz_name, int i_type )
 
     if (i_type & VLC_VAR_DOINHERIT)
         var_Inherit(p_this, psz_name, i_type, &p_var->val);
+#ifndef NDEBUG
+    else
+    {
+        if (var_Type( p_this, psz_name ) != 0)
+            msg_Warn( p_this, "variable '%s' already created in '%s'",
+                      psz_name, vlc_object_typename(p_this) );
+    }
+#endif
 
     vlc_object_internals_t *p_priv = vlc_internals( p_this );
     void **pp_var;
-- 
2.17.1
    
    
More information about the vlc-devel
mailing list