hotkeys: appropriate var_FreeList()

This commit is contained in:
Rémi Denis-Courmont 2018-06-10 11:51:00 +03:00
parent 47e3ce983c
commit 5882b2590f
4 changed files with 20 additions and 28 deletions

View File

@ -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

View File

@ -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 )
{

View File

@ -486,7 +486,6 @@ var_Create
var_DelCallback
var_DelListCallback
var_Destroy
var_FreeList
var_Get
var_GetAndSet
var_GetChecked

View File

@ -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)