]> git.sesse.net Git - vlc/blobdiff - src/misc/variables.c
Simplify and fix WinCE build
[vlc] / src / misc / variables.c
index 801782ebe5c82bfa09314b2b505b8347a9ace4a8..e3d480e7235983b04c88472f568abb3a30323017 100644 (file)
 #endif
 
 #include "libvlc.h"
+#include "config/configuration.h"
 
 #include <assert.h>
 #include <math.h>
 #include <limits.h>
+#ifdef __GLIBC__
+# include <dlfcn.h>
+#endif
 
 /*****************************************************************************
  * Private types
@@ -90,7 +94,6 @@ static void DupString( vlc_value_t *p_val )
 
 static void FreeDummy( vlc_value_t *p_val ) { (void)p_val; /* unused */ }
 static void FreeString( vlc_value_t *p_val ) { free( p_val->psz_string ); }
-static void FreeMutex( vlc_value_t *p_val ) { vlc_mutex_destroy( (vlc_mutex_t*)p_val->p_address ); free( p_val->p_address ); }
 
 static void FreeList( vlc_value_t *p_val )
 {
@@ -102,9 +105,6 @@ static void FreeList( vlc_value_t *p_val )
         case VLC_VAR_STRING:
             FreeString( &p_val->p_list->p_values[i] );
             break;
-        case VLC_VAR_MUTEX:
-            FreeMutex( &p_val->p_list->p_values[i] );
-            break;
         default:
             break;
         }
@@ -124,7 +124,6 @@ addr_ops   = { CmpAddress, DupDummy,  FreeDummy,  },
 bool_ops   = { CmpBool,    DupDummy,  FreeDummy,  },
 float_ops  = { CmpFloat,   DupDummy,  FreeDummy,  },
 int_ops    = { CmpInt,     DupDummy,  FreeDummy,  },
-mutex_ops  = { CmpAddress, DupDummy,  FreeMutex,  },
 string_ops = { CmpString,  DupString, FreeString, },
 time_ops   = { CmpTime,    DupDummy,  FreeDummy,  },
 coords_ops = { NULL,       DupDummy,  FreeDummy,  };
@@ -171,6 +170,25 @@ static void Destroy( variable_t *p_var )
         free( p_var->choices.p_values );
         free( p_var->choices_text.p_values );
     }
+#if 0 // ndef NDEBUG
+    for (int i = 0; i < p_var->i_entries; i++)
+    {
+        const char *file = "?", *symbol = "?";
+        const void *addr = p_var->p_entries[i].pf_callback;
+# ifdef __GLIBC__
+        Dl_info info;
+
+        if (dladdr (addr, &info))
+        {
+            if (info.dli_fname) file = info.dli_fname;
+            if (info.dli_sname) symbol = info.dli_sname;
+        }
+# endif
+        fprintf (stderr, "Error: callback on \"%s\" dangling %s(%s)[%p]\n",
+                 p_var->psz_name, file, symbol, addr);
+    }
+#endif
+
     free( p_var->psz_name );
     free( p_var->psz_text );
     free( p_var->p_entries );
@@ -248,11 +266,6 @@ int var_Create( vlc_object_t *p_this, const char *psz_name, int i_type )
             p_var->ops = &addr_ops;
             p_var->val.p_address = NULL;
             break;
-        case VLC_VAR_MUTEX:
-            p_var->ops = &mutex_ops;
-            p_var->val.p_address = malloc( sizeof(vlc_mutex_t) );
-            vlc_mutex_init( (vlc_mutex_t*)p_var->val.p_address );
-            break;
         default:
             p_var->ops = &void_ops;
 #ifndef NDEBUG