[vlc-commits] hotkeys: appropriate var_FreeList()

Rémi Denis-Courmont git at videolan.org
Sun Jun 10 12:11:34 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jun 10 11:51:00 2018 +0300| [5882b2590fbd3ff0f23702dda446ade6df94c990] | committer: Rémi Denis-Courmont

hotkeys: appropriate var_FreeList()

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

 include/vlc_variables.h   |  7 -------
 modules/control/hotkeys.c | 20 ++++++++++++++++++++
 src/libvlccore.sym        |  1 -
 src/misc/variables.c      | 20 --------------------
 4 files changed, 20 insertions(+), 28 deletions(-)

diff --git a/include/vlc_variables.h b/include/vlc_variables.h
index fc0f1e351f..7dde1248c1 100644
--- a/include/vlc_variables.h
+++ b/include/vlc_variables.h
@@ -207,13 +207,6 @@ VLC_API int var_GetAndSet(vlc_object_t *obj, const char *name, int op,
  */
 VLC_API int var_Inherit( vlc_object_t *, const char *, int, vlc_value_t * );
 
-/**
- * Frees a list and the associated strings.
- * @param p_val: the list variable
- * @param p_val2: the variable associated or NULL
- */
-VLC_API void var_FreeList( vlc_list_t *, char *** );
-
 
 /*****************************************************************************
  * Variable callbacks
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 593064a6f2..a6c93dd5dd 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -107,6 +107,26 @@ vlc_module_begin ()
 
 vlc_module_end ()
 
+static void var_FreeList( vlc_list_t *values, char ***texts )
+{
+    switch( values->i_type & VLC_VAR_CLASS )
+    {
+        case VLC_VAR_STRING:
+            for( int i = 0; i < values->i_count; i++ )
+                free( values->p_values[i].psz_string );
+            break;
+    }
+
+    free( values->p_values );
+
+    if( texts != NULL )
+    {
+        for( int i = 0; i < values->i_count; i++ )
+            free( (*texts)[i] );
+        free( *texts );
+    }
+}
+
 static int MovedEvent( vlc_object_t *p_this, char const *psz_var,
                        vlc_value_t oldval, vlc_value_t newval, void *p_data )
 {
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 0c3a070fdb..e32a686da4 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -486,7 +486,6 @@ var_Create
 var_DelCallback
 var_DelListCallback
 var_Destroy
-var_FreeList
 var_Get
 var_GetAndSet
 var_GetChecked
diff --git a/src/misc/variables.c b/src/misc/variables.c
index 293b7e2f6d..04979dc512 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -1124,26 +1124,6 @@ error:
     return VLC_EGENERIC;
 }
 
-void var_FreeList( vlc_list_t *values, char ***texts )
-{
-    switch( values->i_type & VLC_VAR_CLASS )
-    {
-        case VLC_VAR_STRING:
-            for( int i = 0; i < values->i_count; i++ )
-                free( values->p_values[i].psz_string );
-            break;
-    }
-
-    free( values->p_values );
-
-    if( texts != NULL )
-    {
-        for( int i = 0; i < values->i_count; i++ )
-            free( (*texts)[i] );
-        free( *texts );
-    }
-}
-
 static void DumpVariable(const void *data, const VISIT which, const int depth)
 {
     if (which != postorder && which != leaf)



More information about the vlc-commits mailing list